Skip to content

Menu

Shell Escape Tool

Escape arguments for shell commands

Runs entirely in your browserEncodingFree, no sign-up
Loading tool

01What is Shell Escape Tool?

A file called My Documents/file (copy).txt looks harmless until you pass it to a script. The shell splits it at the spaces and chokes on the brackets. This tool quotes text so a shell reads it as one literal argument, and it can also strip quoting off to show what a command really receives. It works line by line. Paste five arguments on five lines and each one is quoted on its own. Pick one of three shells. Bash (single quotes) leaves a line alone if it only holds letters, digits and the characters @ % _ + = : , . / and -. Anything else gets wrapped in single quotes. The POSIX shell spec says nothing inside single quotes is special, except the closing quote. So an embedded apostrophe becomes '\'' which closes the quote, adds an escaped quote and opens a new one. POSIX (backslash) skips the quotes and puts a backslash before each risky character. That list covers space, tab, both quote marks, $, backticks, !, #, &, |, ;, brackets of every kind, *, ?, ~ and ^. PowerShell also uses single quotes, but it doubles an embedded quote instead. Microsoft's quoting rules treat the curly quotes ‘ and ’ as single quotes too, so the tool doubles those as well. An empty line becomes '' in every mode, so a blank argument doesn't vanish. A quick example. The name John O'Brien comes out as 'John O'\''Brien' for Bash, John\ O\'Brien for POSIX and 'John O''Brien' for PowerShell. Unescape mode runs the other way. It reads a line the way the shell's word splitter would. Single quotes keep everything literal. Within double quotes, POSIX shells treat a backslash as special only before $, `, " and \. Outside quotes a backslash escapes the next character. In Bash mode it also decodes $'...' strings, so $'a\tb' becomes a real tab. For PowerShell it handles doubled quotes and backtick escapes like `t and `n. Each resulting word goes on its own line. Know where it stops. Unescape never expands $HOME, $(...) or globs. It shows them literally and adds a warning instead. An unclosed quote produces an error that names the line. Because each line is processed alone, an argument that itself contains a newline can't be produced in Escape mode. The input stays in your browser tab, since all of the quoting is done by script on the page.

Developers and sysadmins who build shell commands by hand and want each argument to arrive exactly as written. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Shell Escape Tool

  1. Choose Escape or Unescape from the Mode dropdown.
  2. Pick a Shell: Bash (single quotes), POSIX (backslash) or PowerShell.
  3. Paste one argument per line into Input.
  4. Read the result in Output and check any warning shown under it.
  5. Click Copy, or Reset to clear the input.

03Worked examples

Input: /home/user/My Documents/file (copy).txt
Result: Bash: '/home/user/My Documents/file (copy).txt' POSIX: /home/user/My\ Documents/file\ \(copy\).txt PowerShell: '/home/user/My Documents/file (copy).txt'
Same input in all three shells.
Input: John O'Brien
Result: Bash: 'John O'\''Brien' POSIX: John\ O\'Brien PowerShell: 'John O''Brien'
Bash closes and reopens the quote around an escaped apostrophe. PowerShell doubles it.
Input: safe-name_1.txt
Result: safe-name_1.txt (Bash, POSIX and PowerShell)
Only safe characters, so no quoting is added.
Input: $(whoami)
Result: Bash: '$(whoami)' POSIX: \$\(whoami\)
Both forms stop the command substitution from running.
Input: Unescape (Bash): 'John O'\''Brien' $'a\tb' "x y"
Result: John O'Brien a<TAB>b x y
Three words, one per line. The \t inside $'...' becomes a real tab, shown here as <TAB>.
Input: Unescape (POSIX): "cost: $HOME"
Result: cost: $HOME
The variable is not expanded. The tool shows a warning saying so.

04Common use cases

  • Quoting a path with spaces and parentheses before dropping it into a bash script or Makefile recipe
  • Wrapping a user-supplied string for an ssh or docker exec command you are building by hand
  • Passing a name with an apostrophe, like O'Brien, to a PowerShell script parameter
  • Pulling apart a long escaped command from a CI log to see the actual arguments
  • Checking how a JSON body must be quoted for curl -d on the command line
  • Spotting during a code review that a $(...) inside double quotes would run

05Tips

  • Single quotes stop all expansion, so '$(whoami)' stays text. That is usually what you want for untrusted input.
  • In real code, skip the shell. Pass an argument list to execFile or subprocess.run instead of escaping a string.
  • If Unescape splits your line into several rows, there was an unquoted space in it. The shell would see separate arguments too.
  • To check a result in a real terminal, run printf '[%s]\n' followed by the escaped text. Each argument prints in its own brackets.
  • Smart quotes pasted from a chat app are doubled in PowerShell mode, but bash treats them as plain characters.

06Related concepts

Shell quoting, Command injection, Bash, PowerShell, POSIX sh.

Frequently Asked Questions

What is Shell Escape Tool?

Shell Escape Tool is a free, browser-based developer tool on AIDToolStack. Escape arguments for shell commands It requires no installation or sign-up and works entirely in your browser.

Is Shell Escape Tool free to use?

Yes. No sign-up, no fees and no usage cap.

Does Shell Escape Tool store my data?

No. It runs in your browser; nothing is uploaded.

Cheat sheet

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe