JS · STRING ENCODER

JavaScript Escape/Unescape

Turn text into a ready-to-paste JavaScript string literal, or decode escaped string contents back to text. Unicode-aware and safe: your input is never evaluated.

Runs in a worker · No eval · No code execution or upload
Escape outputs a complete quoted string. Unescape accepts a quoted literal or raw escaped contents.Explore JavaScript tools →
Input textMaximum 1 MiB
Output
This decodes string content only; it does not parse a complete JavaScript program.
Ready · Input is processed locallyInput: 0 B · Output: 0 B
◆ HOW IT WORKS

Encode and decode JavaScript string values

Handle quotes, slashes, line breaks and Unicode without running JavaScript.

Escape text wraps the result in your chosen quote style and encodes special characters such as quotes, backslashes, tabs, newlines and control characters. Unicode is kept readable by default; turn on the Unicode option to emit \u escapes for non-ASCII characters.

The result is a string literal value only. Add a variable assignment or other surrounding syntax yourself.

Unescape string decodes common JavaScript escapes, \xNN, \uNNNN, \u{...} and escaped line breaks. A quoted single- or double-quoted literal can be pasted as-is, or paste only its contents.

This is not a full JavaScript parser. It does not evaluate expressions, template literals, concatenation or assignments.

◐ THREE STEPS

How to convert a JavaScript string

Choose a direction, add text, and copy the result.

1

Select Escape or Unescape

Escape creates a quoted literal; Unescape decodes a string value.

2

Enter your text

Choose single or double quotes for Escape. Unicode escapes are optional.

3

Copy or download

Review the result, then copy it into your JavaScript source.

FAQ

Frequently asked questions

Escape wraps your text as a complete single- or double-quoted JavaScript string literal and encodes quotes, backslashes, line breaks and control characters.

It decodes common JavaScript string escapes, hexadecimal escapes, four-digit Unicode escapes, code-point Unicode escapes and escaped line breaks. Paste a quoted string literal or only its escaped contents.

No. It uses a string-processing routine in a worker. It never calls eval or Function and does not execute pasted code.

No. It decodes a string value only; it does not validate surrounding assignments, templates, expressions or source code.

No. Processing happens locally in a time-limited browser worker. The page does not upload or store your input.

The maximum input size is 1 MiB. Automatic processing pauses on large input; click Run conversion to process it manually.