Escape string

Escapes special characters in a string so that they do not cause conflicts. For example, Don't stop me now becomes Don\'t stop me now.

Input: TextResult: Text

Text input

Tool options

Examples

Represent 'He said "hello".' as a JSON string

Input

He said "hello".

Expected answer

"He said \"hello\"."
Escape level
Minimal
Escape quote
Double
JSON compatible
On
ES6 compatible
On
Uppercase hex
Off
Represent 'C:\\logs\\release.txt' as a JSON string

Input

C:\logs\release.txt

Expected answer

"C:\\logs\\release.txt"
Escape level
Minimal
Escape quote
Double
JSON compatible
On
ES6 compatible
On
Uppercase hex
Off
Represent 'line one\nline two' as a JSON string

Input

line one
line two

Expected answer

"line one\nline two"
Escape level
Minimal
Escape quote
Double
JSON compatible
On
ES6 compatible
On
Uppercase hex
Off
Represent 'tab\tseparated' as a JSON string

Input

tab	separated

Expected answer

"tab\tseparated"
Escape level
Minimal
Escape quote
Double
JSON compatible
On
ES6 compatible
On
Uppercase hex
Off
Represent "single quote: '" as a JSON string

Input

single quote: '

Expected answer

"single quote: '"
Escape level
Minimal
Escape quote
Double
JSON compatible
On
ES6 compatible
On
Uppercase hex
Off
complex

Input

4ec985786aa10a7515d8be2d.bin

115 bytes

Download

Expected answer

null\0backspace\btab\tnewline\nverticaltab\x0bformfeed\fcarriagereturn\rdoublequote"singlequote\'hex\xa9unicode\u2665codepoint\u{1d306}
Escape level
Special chars
Escape quote
Single
JSON compatible
Off
ES6 compatible
On
Uppercase hex
Off
double quotes

Input

Hello "World"!

Expected answer

Hello \"World\"!
Escape level
Special chars
Escape quote
Double
JSON compatible
Off
ES6 compatible
On
Uppercase hex
Off
single quotes

Input

Escape 'these' quotes.

Expected answer

Escape \'these\' quotes.
Escape level
Special chars
Escape quote
Single
JSON compatible
Off
ES6 compatible
On
Uppercase hex
Off
special characters

Input

1203ab8e4358d1fe9949e85d.bin

100 bytes

Download

Expected answer

Fizz & buzz\n\ttabbed newline\rcarriage returned line\nbackspace character: \"\b\" form feed character: \"\f\"
Escape level
Special chars
Escape quote
Double
JSON compatible
Off
ES6 compatible
On
Uppercase hex
Off

Supports the following escape sequences:\n (Line feed/newline) \r (Carriage return) \t (Horizontal tab) \b (Backspace) \f (Form feed) \xnn (Hex, where n is 0-f) \\ (Backslash) \' (Single quote) \" (Double quote) \unnnn (Unicode character) \u{nnnnnn} (Unicode code point)

Format reference: Escape string background and specification

Parameters

ParameterDefault valueInput and choices
Escape levelSpecial charsSpecial chars, Everything, Minimal
Escape quoteSingleSingle, Double, Backtick
JSON compatiblefalseOn or off
ES6 compatibletrueOn or off
Uppercase hexfalseOn or off

Related tools

Browse utils tools