What This Tool Does
This tool escapes or unescapes a string for four different contexts: embedding it inside a JSON string literal, inserting it into HTML markup, encoding it as part of a URL, or converting non-ASCII characters to \uXXXX Unicode escape sequences. Pick a format, pick a direction, and paste your text, the result updates live as you type with the converted characters highlighted so you can see exactly what changed.
How to Escape or Unescape a String
Choose a format (JSON, HTML, URL, or Unicode) and a direction (Escape or Unescape) from the toolbar, then paste your text into the left panel, the right panel updates instantly with no button to press. Use Swap to send the output back into the input and flip the direction in one click, handy for checking that a round trip produces the original text back. Copy either panel with its Copy button, or load a ready-made example for the current format and direction.
JSON, HTML, URL, and Unicode Escaping Explained
JSON escaping converts quotes, backslashes, and control characters (like newlines and tabs) into the backslash sequences JSON requires inside a string literal, using the same rules as JSON.stringify. HTML escaping converts &, <, >, ", and ' into their named entities (&, <, and so on) so text can be inserted into markup without being interpreted as tags. URL escaping percent-encodes a string using encodeURIComponent semantics, the same encoding used for a single query parameter value or path segment, not a full URL. Unicode escaping converts any character outside the ASCII range into a \uXXXX sequence, covering accented letters, symbols, and CJK text.
Reading the Highlighted Output and Swap
Whichever side already contains escape sequences, the input in Unescape mode, or the freshly produced output in Escape mode, gets its sequences color-highlighted so you can spot every backslash sequence, HTML entity, percent-encoded byte, or \u escape at a glance. The status bar reports the character count of both sides and how much the length changed. Swap is disabled whenever the output is empty or the conversion failed, so it never sends broken input back into the input panel.
Common Uses for a String Escape Tool
Preparing a string with quotes or newlines to paste into a JSON config file or API payload, safely inserting user-provided text into an HTML template without breaking the markup, percent-encoding a value before appending it to a URL query string, and converting non-ASCII text into \u escapes for environments that only accept ASCII source are all common reasons to reach for a dedicated escape tool instead of hand-editing each character. Use it to escape string online or unescape string online, as a json string escape and json escape special characters helper, an html entity encode decode tool, a unicode escape converter to convert string to unicode escape sequences, an escape special characters online utility, and an encodeuricomponent online tool for URL fragments.