Skip to content

String escaper. Both ways, nine formats.

🔒 Your text never leaves your browser. Nothing is uploaded.


What each format escapes

Format Escapes Example
JSON" \ and control chars (\n, \t, …); non-ASCII optionalHe said "hi" → He said \"hi\"
JavaScriptquote char, \, newlines; template mode also ` and ${it's → it\'s
HTML& < >, optionally " ' and non-ASCIIa<b → a&lt;b
URLreserved & unsafe chars → percent-encodinga b → a%20b
Base64everything → A-Z a-z 0-9 + / (UTF-8 safe)hi → aGk=
SQLsingle quote doubled (''); MySQL mode uses backslashesit's → it''s
CSVfield quoted if it holds delimiter / quote / newline; " doubleda,b → "a,b"
Regex. * + ? ^ $ ( ) [ ] { } | \ optionally - /1+1 → 1\+1
Unicodechars → \uXXXX or \u{…} escapesé → é
§ · written guide

How to use the String Escaper

The String Escaper converts text into the escaped form a format needs, and back again. It covers nine formats: JSON, JavaScript, HTML, URL, Base64, SQL, CSV, Regex and Unicode, each with its own options. It is for developers and anyone pasting text into code, a query, a link or a spreadsheet who needs quotes, slashes and special characters handled correctly.

Step by step

  1. Pick a format

    Press JSON, JavaScript, HTML, URL, Base64, SQL, CSV, Regex or Unicode. JSON is selected when the page opens. The reference table What each format escapes, under the tool, shows what each one changes with a short example.

  2. Choose a direction

    Press Escape to encode plain text, or Unescape to turn escaped text back into plain text. Escape is selected first.

  3. Type or paste your text

    Enter text in the Input box. The result appears in Output a moment after you stop typing, and the character count of both boxes shows above them.

  4. Set the options for that format

    The options row changes with the format. For example, JSON and JavaScript offer Include surrounding quotes, JavaScript has a Quote style menu, URL has a Function menu and Spaces as + (form style), SQL has MySQL backslash style, CSV has a Delimiter menu and Always quote field, and Unicode has Scope and Format menus.

  5. Copy, download or chain

    Press Copy output to copy the result, or Download .txt to save it as a file named after the format and direction, such as json-escaped.txt. Swap input/output moves the result into the Input box so you can run another step, and Clear empties both boxes.

Reading the result

  • JSON escaping turns He said "hi" into He said \"hi\". Tick Include surrounding quotes to get a complete JSON string with the outer double quotes.
  • URL with encodeURIComponent turns a space into %20 and also encodes characters such as / ? & and =, which suits a single query value. encodeURI leaves those alone, which suits a whole address.
  • Base64 turns hi into aGk=. It encodes the text as UTF-8 first, so accents and emoji survive the round trip. The URL-safe option uses the minus sign and the underscore in place of + and /, and drops the trailing = padding.
  • SQL doubles single quotes by default, so it's becomes it''s. MySQL backslash style writes it\'s instead and also escapes backslashes and line breaks.
  • If you unescape text that is not valid for the format, such as broken JSON or a stray % in a URL, the Output stays empty and a red line under it says what went wrong.

Tips and common mistakes

  • Swap input/output keeps the same direction. To check a round trip, press Swap input/output and then press Unescape, or you will escape the text twice.
  • CSV mode treats everything in the Input box as one field. Use it to quote a single value, not to convert a whole file.
  • Escaping SQL strings by hand is a stopgap. In application code, pass values as query parameters instead.
  • HTML escaping covers the characters that break markup. Unescape decodes any entity your browser knows, named or numeric.
  • In Unicode mode, the default \uXXXX format splits emoji into two surrogate escapes. Choose the code point format if your language supports it.

Privacy and limits

Every conversion runs in your browser with plain JavaScript. Nothing you type is sent anywhere or saved, so it is safe for tokens and passwords, and the boxes are empty again when you reload the page.

Back to the tool

§ 02 · what you can do

One tool, every escape.

Escape & unescape both waysEvery format runs in reverse too, flip a switch to decode JSON, HTML, URL, Base64 and the rest.
JSON & JavaScript stringsOptional surrounding quotes, single / double / template literals, and non-ASCII to \uXXXX.
HTML entities & URL encodingEncode quotes and numeric entities, or percent-encode with encodeURIComponent / encodeURI.
Base64, SQL & CSVUTF-8-safe Base64 (URL-safe + MIME wrap), standard or MySQL SQL escaping, RFC-style CSV quoting.
Regex & UnicodeEscape every regex metacharacter, or convert to \uXXXX / \u{…} code-point escapes.
Copy, download, swapOne-click copy, download the result as .txt, or swap input and output to chain conversions.
§ 04 · faq

Frequently asked questions.

Is the String Escaper free?
Yes, completely free for everyone. No sign-up, no account and no usage limits.
Is it private? Is my text uploaded anywhere?
No upload, ever. Every conversion runs entirely in your browser on your own device, your text never leaves your computer and nothing is sent to a server.
Does it work offline?
Yes, once the page has loaded, every format keeps working without a connection because all the escaping logic runs locally in JavaScript.
Which formats does it support?
Nine: JSON, JavaScript, HTML entities, URL percent-encoding, Base64, SQL, CSV, regular-expression patterns and Unicode escapes. Each one escapes and unescapes.
What is the difference between JSON and JavaScript escaping?
JSON always uses double quotes and a fixed escape set. JavaScript mode lets you choose single, double or template-literal quotes, template mode also escapes the backtick and ${ interpolation marker.
Does Base64 handle emoji and non-English text?
Yes, the Base64 encoder is UTF-8 aware, so emoji and any non-ASCII characters round-trip correctly. You can also switch to the URL-safe variant or wrap lines at 76 characters for MIME.

Published · Last updated .

Priya sent you a message Online now

Talk to a Developer Now

Share your name and email to reply.

Reply