Backslash Escape
Turn real newlines and tabs into \n and \t sequences, or turn them back.
Runs entirely in your browser.
Escape Backslashes, Newlines and Tabs
About Backslash Escape
This converts the characters that most programming languages write as escape sequences: a real newline becomes \n, a tab becomes \t, a carriage return \r, and backslashes and double quotes get a backslash in front. The result is a single line you can paste into source code as a string literal.
Unescaping goes the other way, which is the useful direction when you have copied a log line or an error message full of \n and want to read it as real text.
Other Escaping Tools
- Escape / Unescape — every format on one page
- SQL Escape — quotes and backslashes for SQL literals
- Regex Escape — escape regular expression metacharacters
- XML Escape — the five reserved XML characters
- CSV Escape — quote a value for a CSV field
- HTML Entities — encode and decode HTML entities
- URL Encode / Decode — percent-encoding
- JSON Stringify — escape JSON into a string literal