Slash-escape Text
Escape special characters with backslashes instantly.
Options
Escaped output
How to slash-escape text
Paste your text into Your text, or press Load example. The escaped version
appears next to it and updates as you type. For example, Path: C:\temp\"file" followed by a line
break and a tab becomes its backslash-escaped form. Copy the result or download it as a .txt file.
Everything runs in your browser, so nothing you paste is uploaded.
Examples
| Input | Output |
|---|---|
| a\b | a\\b |
| Say "hi" | Say \"hi\" |
| Line one Line two | Line one\nLine two |
Limits and edge cases
- Backslashes are escaped first, so quotes and control sequences added later are never re-escaped.
- Already-escaped text is escaped again: a literal backslash-n becomes backslash-backslash-n.
- Unicode letters, emoji, spaces and forward slashes are not escaped and pass through untouched.
Frequently asked questions
How do I escape text with slashes?
Paste your text into the input box and the escaped version appears instantly. Copy it or download it as a .txt file.
Which characters get escaped?
Backslashes, single quotes, double quotes, newlines, carriage returns and tabs. Each one can be toggled in the options.
Why did my backslashes double?
Backslashes are escaped first, so each backslash becomes two. Already-escaped text gets escaped again, which is expected.
What does a newline become?
A real line break becomes the two characters backslash and n. Tabs become backslash and t, and carriage returns become backslash and r.
Is unicode or emoji changed?
No. Letters like cafe with accents, emoji, spaces and forward slashes pass through untouched.
Is my text uploaded anywhere?
No. Escaping runs in your browser with JavaScript and nothing is sent to a server. Inputs under 200 KB are kept in your browser's local storage so they are still there when you come back.