Backslash Escape / Unescape
Escape or unescape special characters. Convert \n, \t, \", and more.
Common Escapes:
\\n = newline, \\t = tab, \\r = carriage return, \\" = quote, \\\\ = backslash
About Backslash Escape / Unescape
Escape special characters in a string for safe use in JavaScript, JSON, or other languages — converting literal newlines to \n, tabs to \t, backslashes to \\, quotes to \", and so on. Or unescape a string with escape sequences back to its readable form with actual newlines and tabs. Also supports Unicode escapes (\uXXXX). Useful for working with JSON string values, debugging escaped strings, and preparing string literals.
All processing happens entirely in your browser using modern web APIs. Nothing is uploaded to our servers — your data stays local and private. Free to use forever, with a Pro plan for power users who want an ad-free experience and API access.
Common use cases
- Preparing a multiline string for use as a JSON value (converting real newlines to \n)
- Unescaping a copied string from JSON to see its actual content with newlines
- Escaping a file path with backslashes for use in a JavaScript string
- Converting a string with special characters into a safe JavaScript string literal
- Debugging a string value that appears to have escape sequences in it
How it works
Escaping replaces each special character with its escape sequence: newline (U+000A) → \n, tab (U+0009) → \t, carriage return (U+000D) → \r, double quote (U+0022) → \", backslash (U+005C) → \\. Unescaping does the reverse using a regex that matches \n, \t, \r, \", \\, \uXXXX, and \xXX sequences.