Skip to main content

String Escape

Escape or unescape strings for JSON, HTML, URL, XML, CSV, SQL, regex, and JavaScript.

Free & unlimited
Format
Direction
Input
Result
Hello \"world\"\nLine break here\tand a tab.
All processing happens in your browser. No data is sent to any server.

About this tool

  1. 1

    Enter your string

    Paste or type the text you want to escape or unescape.

  2. 2

    Select the format

    Choose the escaping format: JSON, HTML, URL, JavaScript, or regex.

  3. 3

    Choose the direction

    Click Escape to add escape sequences, or Unescape to remove them and restore the original text.

  4. 4

    Copy the result

    Copy the escaped or unescaped string from the output.

  • Use JSON escape when embedding strings in JSON files - it handles quotes, backslashes, and control characters.
  • JavaScript escape is useful for strings inside template literals or concatenated strings.
  • Regex escape adds backslashes before special regex characters (. * + ? ^ $ { } ( ) | [ ] \).
  • When debugging, unescape strings to see the actual content hidden behind escape sequences.
  • Supports JSON, HTML, URL, JavaScript, and regex escaping formats
  • Bidirectional escape and unescape for all formats
  • Handles Unicode escape sequences (\uXXXX)
  • Real-time transformation as you type
  • Shows a visual diff of which characters were escaped
  • Escape strings for safe embedding in JSON configuration files
  • Prepare user input for inclusion in HTML without rendering as markup
  • Escape special characters in strings used in regex patterns
  • Unescape JSON or JavaScript strings to inspect their actual content during debugging
JSON escaping is stricter - it uses double quotes and requires escaping certain characters like forward slashes. JavaScript escaping supports both quote styles and has additional escape sequences like \x hex codes.
When you want to match literal special characters (like . or *) in a regular expression, you need to escape them with a backslash so the regex engine treats them as literal characters, not operators.
Yes. Newlines are converted to \n in JSON/JavaScript escaping, and the tool correctly unescapes \n back to actual line breaks.

Related tools

View all

We use anonymous analytics to improve ToolChamp. No personal data is stored or sold. Privacy Policy