String Escape

Escape and unescape strings for JSON, JavaScript, HTML, XML, URL, CSV and more

String Escape/Unescape Tool — Convert Text Between Raw and Escaped Formats for JSON, JavaScript, HTML, XML, URL, CSV, Java, and Unicode

  1. Paste or type your source text into the Input textarea. The tool accepts any text — from single-line strings to multi-paragraph documents with special characters. String escaping is a fundamental concept in programming and data interchange: certain characters (like double quotes in JSON, angle brackets in HTML, or newlines in CSV) have special meaning in their respective contexts and must be 'escaped' — replaced with an alternative representation — to be treated as literal text rather than control characters. Conversely, 'unescaping' converts escaped sequences back to their original literal form.
  2. Select the Escape Type from the dropdown — the tool supports 8 distinct escaping schemes: JSON (double quotes, backslashes, control characters → \n, \t, \"), JavaScript (same as JSON plus single-quote string escaping and template literal support), Java (Java string literal escaping with Unicode \uXXXX sequences), HTML (entities like < for <, & for &), XML (the five predefined XML entities plus numeric character references), CSV (field quoting and embedded quote doubling for RFC 4180 compliance), URL (percent-encoding %20 for spaces, %2F for slashes), and Unicode (\uXXXX escape sequences for any non-ASCII character). Choose Escape to add escape sequences or Unescape to convert them back to raw text.
  3. Configure optional settings: Preserve whitespace (HTML/XML only) keeps spaces and line breaks intact rather than normalizing them — important when escaping pre-formatted text or code blocks. Click Process to perform the conversion, then review the output and use Copy Output to transfer the result. The Swap button quickly reverses the direction, and Show Original lets you compare input and output side by side. All escaping and unescaping happens entirely in your browser using JavaScript's built-in string manipulation — your text never leaves your device, making this safe for sensitive data like API keys, authentication tokens, and proprietary source code.

Enable JavaScript to use these tools.