String Escaper
Make a string safe to paste inside a literal for the language or format you pick, or reverse a value that is already escaped. Each target uses its own rules: shell single-quote wrapping, SQL doubled quotes, CSV quoting, percent-encoding, entity encoding, generic backslash escapes for control characters, and Unicode code-point notations (\uXXXX, \xXX, \u{…}, U+XXXX, CSS and HTML numeric forms).
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Applies to the escape direction. Unescaping always accepts every form at once.
Applies to the Unicode escape direction.
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
One string, many literal dialects
Pick a target and a direction and the text is made safe for that literal, or decoded back out of one. Shell wraps the value in single quotes and rewrites embedded apostrophes, SQL doubles quotes, CSV quotes and escapes per RFC 4180, URL percent-encodes, HTML and XML encode entities, and the generic backslash target turns control characters into sequences like \n and \xNN.
Fitting a value into another syntax
The everyday case is a string that has to be embedded: a Windows path going into a SQL statement, a quote-heavy message inside a JSON field, or a filename with spaces and apostrophes going into a shell command about to be pasted into a terminal.
Target, direction and the Unicode options
The target list covers JavaScript and TypeScript, JSON, C, Java, Python, POSIX shell, SQL, CSV, HTML, XML, URL components, generic backslash escapes and Unicode code points. Direction toggles between escaping and unescaping, while the Unicode style (JavaScript, Python, CSS, HTML numeric or U+XXXX) and the only-non-ASCII versus all-characters choice apply when escaping.
Where it refuses or warns
URL unescaping throws on malformed percent-encoding and JSON unescaping throws when the text is not a valid JSON string; a malformed \u{…} code point is rejected too. The generic backslash target quietly drops an unknown escape such as \q, keeps the letter, and lists each distinct unknown escape beneath the output.
Escaping never leaves the tab
Every conversion runs in this browser, so the passwords, tokens and configuration snippets pasted in for quoting travel nowhere.
Questions
Does the JSON target add surrounding quotes?
Yes. JSON strings are quoted by definition, so escaping produces a complete "…" literal and unescaping accepts one with or without the outer quotes.
How does the shell target escape a string?
It wraps the whole value in single quotes and rewrites every embedded ' as '\'' , which is safe for POSIX sh and bash.
Which unescape operations can fail?
URL unescaping throws on malformed percent-encoding, JSON unescaping throws when the text is not a valid JSON string, and the generic backslash target throws on a malformed \u{…} code point.
What happens to an unknown backslash escape like \q?
The generic backslash target drops the backslash, keeps the letter, and lists every distinct unknown escape in a note under the output.
Does escaping Unicode depend on the escape direction?
The style and "which characters" options apply when escaping. Unescaping accepts every form at once — \uXXXX, \u{…}, \xXX, \UXXXXXXXX, U+XXXX, &#xHHHH; and CSS \HHHHHH — so mixed input just works.
Related tools
See categoryHTML Entity Encode / Decode
Escape text for safe insertion into HTML, or decode named and numeric entities.
URL Encode / Decode
Percent-encode or decode text for use in URLs — component or whole-URL mode.
Hex Encode / Decode
Convert text to and from hexadecimal (UTF-8), with configurable separators.
Base64 Encode / Decode
Convert text or a file to and from Base64, with URL-safe and MIME line-wrap options.