Another spelling of the same bytes
Escape text with backslashes
Newlines, tabs, quotes, and backslashes become \n, \t, \", and \\.
Characters outside ASCII become \uXXXX. Decoding also accepts \xHH.
The work stays in this tab.
This tool runs in your browser. Turn on JavaScript to use it.
Backslash escapes
The sample is fixed. It uses the same rule as the form.
- Input
- a"b
- Result
- a\"b
How to use it
- 1Paste the text.
- 2Choose encode or decode.
- 3Copy the result.
Good to know
- The result has no surrounding quotes.
- This page does not upload the text.
- Text longer than one hundred thousand characters is rejected.
Questions
Does the result leave this browser?
No. The calculation finishes in the current tab.
What does this page leave out?
The result has no surrounding quotes.
What if the input is huge?
Past one hundred thousand characters, the page stops and asks you to shorten it.
Related tools
- Escape a JSON string
The result is a JSON string, including the quotes JSON.stringify adds.
- Inspect Unicode code points
A character you see may be one code point or several. This page lists the first 80 code points, with U+ notation, decimal, UTF-8 bytes, and a JavaScript escape.
- Encode text as hexadecimal
Hex is a way to show raw bytes. This page encodes text as UTF-8 first, then prints each byte. Decoding accepts only an even number of digits and rejects bytes that are not UTF-8.