Loading tool…
Escape special characters into backslash sequences for code, or unescape them back to raw text.
Loading tool…
Backslash Escape is a free, private online tool that lets you escape or unescape backslash sequences (\n, \t, quotes) in strings. It runs entirely in your browser, so nothing you enter is uploaded to a server.
Privacy: this tool runs entirely in your browser. Your input is never sent to, received by, or stored on any server — there are no uploads and no tracking of what you enter.
Programming languages represent newlines and tabs as \n and \t, and quotes must be escaped inside string literals. This tool converts between raw text and escaped form.
Backslash, newline, tab, carriage return and double quotes are escaped or unescaped in both directions.
Pasting multi-line text into source code, JSON string values and config files.
Many programming languages and data formats use the backslash as an escape character to represent things that are hard to type literally inside a string - a newline as \n, a tab as \t, a quote as \", and a literal backslash as \\. This tool converts text to and from that escaped form.
If you paste multi-line text directly into a string in code, it usually breaks the syntax - the line breaks and quotes terminate the string early. Escaping first makes the text a single valid string. Conversely, when you read escaped data from a log or a JSON field, unescaping reveals what it really says. It is a constant need when moving text between human-readable and code-embedded forms.
Embedding multi-line text or file contents into source code, preparing values for JSON or config files, reading escaped strings out of logs and API responses, and debugging why a string contains literal \n instead of a line break. It covers the common escapes shared by most languages and JSON.
Choose escape or unescape, paste your text, and the result updates instantly. The supported sequences are \n, \t, \r, \" and \\. Everything runs in your browser.