← All Tools
String Escaper🔒 100% local
Escape/unescape strings for JavaScript, HTML, URL, Regex, SQL, CSV, Base64, Hex, Shell. All in-browser.
Shows one piece of text rendered in nine escape formats at once: a JavaScript/JSON string literal, HTML entities, a URL component, a regex literal, a SQL single-quoted literal, a CSV field, Base64, upper-case hex bytes and a POSIX shell single-quoted word. Paste the text once and every row appears together in one output block.
How to use it
- Type or paste the text into the input box.
- Press Process; the nine labelled rows appear below, each padded so the colons line up.
- Find the row for the format you need and copy it out of the block.
- Press Clear to empty both boxes and start again.
Worked example
it's <b>becomesJavaScript / JSON : "it's <b>"
HTML : it's <b>
URL (encodeURIComponent) : it's%20%3Cb%3E
Regex : it's <b>
SQL single-quoted : it''s <b>
CSV : it's <b>
Base64 : aXQncyA8Yj4=
Hex (UTF-8 bytes) : 69742773203C623E
Shell (single-quoted) : 'it'\''s <b>'The HTML row escapes the apostrophe and both angle brackets, while the URL row percent-encodes them and the Shell row uses the POSIX quote-out form.
'a,b'becomesCSV : "a,b"Only the CSV row shown. A value containing a comma is wrapped in double quotes; an input without a quote, comma or newline is emitted bare.
When to use it
- Dropping a user-supplied value into a shell command line or a curl call without the quoting breaking.
- Wrapping a snippet in a JavaScript string literal without counting escape characters by hand.
- Seeing what a comma inside a CSV field looks like once it has been quoted.
What it does not do
- The HTML row escapes the five markup characters and nothing else, so it is not a sanitiser: an unquoted attribute value, a backtick or a javascript: URL still has to be handled at its destination.
- Despite the description, there is no unescape direction - the tool only ever escapes.
- All nine rows are produced from every input, and the escaping is literal rather than contextual: the regex row leaves angle brackets alone, and the CSV row only quotes the value when it contains a quote, a comma or a newline.
- Output is one flat block of text; there is no way to select a single format or to copy just one row.