Escape / Unescape
Escape or unescape text for C# strings, JSON, regex, URLs and HTML, locally.
Escape or unescape a string for five different targets
Copying a multi-line string, a file path or a piece of user input into source code or a URL usually means escaping backslashes, quotes or reserved characters by hand. This tool takes plain text and produces an escaped version for a C# string literal, a JSON string, a regular expression, a URL, or HTML, and it also reverses each of those, turning an escaped string back into readable text. It runs locally, so the text never leaves your browser.
How to use the Escape / Unescape
- Type or paste text into the input box.
- Pick a target from the dropdown: C# string, JSON string, Regex, URL or HTML.
- Use the Escape and Unescape buttons to switch direction, or click the swap icon between the two panels to flip the current output back into the input.
- Copy the result, or send it to another tool with Send To once it looks right.
C# escaping covers backslash, double quote, newline, carriage return, tab, form feed, vertical tab and the null character; unescaping also decodes \uXXXX and \xXXXX hex sequences back into their actual characters.
URL escaping uses JavaScript's encodeURIComponent/decodeURIComponent, so it percent-encodes reserved characters the way a query string parameter needs, not the looser rules used for a full URL.
Frequently asked questions
- How do I escape a string for a C# literal?
- Select C# string as the target and Escape as the mode; the tool backslash-escapes quotes, backslashes and control characters like newline and tab so the result can be pasted directly between double quotes in C# source code.
- What's the difference between JSON escaping and C# escaping here?
- JSON escaping uses JSON.stringify internally and follows the JSON spec exactly, while C# escaping additionally handles C#-specific escapes like \0 for the null character and \v for vertical tab, which JSON strings do not support.
- Can I unescape HTML entities back into plain text?
- Yes, switch to Unescape with HTML selected and it decodes named entities like & and " as well as numeric entities such as ' or ' back into their literal characters.
- Does escaping my text send it anywhere?
- No, every target runs a plain JavaScript string transform in your browser tab, so text you paste in, including source snippets or URLs with query parameters, is never sent to a server for processing.