ForHosting KIT · Text & AI

Shell escape (POSIX)

Turn any text into a safe shell argument: «it's» comes out as 'it'\''s', which bash reads back as exactly it's. Choose single quotes, double quotes or the automatic option; nothing is ever executed. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Text
it's
You get
Style
Single
Escaped
'it'\''s'

Escape a string for safe literal use in a POSIX shell. Search intent: escape string for bash / shell escape. No network calls, no random seeds, and no server state are required for a correct answer.

Why text needs escaping before it reaches a shell

A POSIX shell such as bash does not read a line as plain text. Spaces separate arguments, quotes group them, and several symbols have special meanings, so a file name with a space or a message with an apostrophe can break a command or change what it does. Escaping wraps the text so the shell treats it as one literal value, exactly as you typed it. This tool does that for you in three styles, single quotes, double quotes or an automatic option, and it only produces the quoted result; nothing is executed and no network calls are made.

Reading the single-quote result

Inside single quotes everything is literal, which makes that style very predictable, but a single quote itself cannot appear inside them. The fix looks odd at first. Take «it's»: the tool returns 'it'\''s'. Read it in pieces: a quote opens, it follows, the quote closes, a backslash and a quote add one literal apostrophe, a new quote opens, s follows and the quote closes. The shell joins those pieces into the single word it's. The classic mistake is wrapping text in single quotes by hand and forgetting an apostrophe in the middle, which ends the quote early.

How it works

Escape a string for safe literal use in a POSIX shell. Supports single-quote, double-quote, and auto styles without executing anything. The implementation is pure JavaScript with no external services.

No network calls, no random seeds, and no server state are required for a correct answer. Failed jobs are not billed. Landings target the stated search intent with precise keywords.

Prefer explicit units and ranges over silent coercion of bad types. When a field is optional, defaults are documented in params and echoed in the output. This

When to use it

Use this when your search intent matches the calculator name and you need a reproducible answer for teaching, finance ops, GIS, text tooling, or unit history work. Escape a string for safe literal use in a POSIX shell. No network calls, no random seeds, and no server state are required for a correct answer.

Failed jobs are not billed. Landings target the stated search intent with precise keywords. Prefer explicit units and ranges over silent coercion of bad types.

When a field is optional, defaults are

Does it call the network?

No. All math and text transforms are local and deterministic.

Why does 'it'\''s' look so strange?

Because a single quote cannot appear inside single quotes. The quote is closed, a backslash and a quote add one literal apostrophe, and the quote is opened again. The shell glues the pieces back into the original word.

Does the tool run my command?

No. It only produces the quoted text and executes nothing. You copy the result and paste it into your own script or terminal, where the shell receives it as one literal value.

Which quoting style should I choose?

There are three: single quotes, double quotes and an automatic option that chooses for you. Whichever you pick, the result is meant to reach the shell as one literal piece of text, exactly as you typed it.

Why do I need to escape text for the shell at all?

Because a shell gives special meaning to spaces, quotes and several symbols, so an unescaped file name or message can split into pieces or trigger something you did not intend. Escaping makes it arrive as plain literal text.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/text/shell-escape

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/text/shell-escape \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"it'\''s a test"}'
{
  "text": "it's a test"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "text.shell_escape",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

The calculator is free in the browser, deterministic, and identical in the API path. Inputs are validated before any arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE results when decimals are requested. Use the same JSON contract

How it works

The calculator is free in the browser, deterministic, and identical in the API path. Inputs are validated before any arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE results when decimals are requested. Use the same JSON contract from spreadsheets, CMS hooks, automation, or teaching demos.

Inputs, limits and rounding

Optional decimals use half-up once. No network calls, no random seeds, and no server state are required for a correct answer. Failed jobs are not billed. Landings target the stated search intent with precise keywords. Prefer explicit units and ranges over silent coercion of bad types. When Provide the required parameters as JSON numbers or strings as documented. Invalid types, missing required fields, or out-of-range values raise invalid_input with a clear message. Outputs echo key inputs so automation can log the full context of each call. The calculator is free in the browser, deterministic, and identical in the API path. Inputs are validated before any arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE results when decimals are requested. Use the same JSON contract from spreadsheets, CMS hooks, automation, or teaching demos.

When to use it

The calculator is free in the browser, deterministic, and identical in the API path. Inputs are validated before any arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE results when decimals are requested. Use the same JSON contract from spreadsheets, CMS hooks, automation, or teaching demos.

Quick check

Paste values in the free widget and compare with a spreadsheet.

Automation

Call the API with the same JSON contract from n8n, scripts, or CMS.

Teaching

Show the formula and pinned golden examples without proprietary software.

Is it free in the browser?

Yes. Tier A runs fully client-side with the same core as the API.

What happens on bad input?

The handler throws invalid_input; failed jobs are not billed.

Can I use it from the API?

Yes. Send the same JSON fields documented in params.

Who authors this?

Aspire (elon@forhosting.com), EN-only delivery; Nitro hydrates locales.

Read the full KIT documentation →