SmartTechnology solutions for business

String Escape Converter

Show or generate escape sequences for text and Unicode, for an output language you choose.

Direction
Format

A double-quoted JSON string. Control characters become \n, \t, and \u codes.

Your result

Type text and the escaped literal appears here.

How to use it

  1. Choose escape or unescape, and the format.
  2. Type the text or press Try a sample.
  3. Copy the result, or swap to check it.

Examples

  • JSONA "quote" "A \"quote\""
  • PHPA 'quote' 'A \'quote\''
  • \u codesAب A\u0628
Tool details and privacy

Type text with quotes and line breaks to get a string ready to paste into code, or paste an escaped string to read the plain text.

One quote or backslash in the wrong place breaks code or a JSON file.

Options

  • JSON: double quotes, with control characters as \n, \t, and \u.
  • JavaScript: single quotes with \n, \r, and \t.
  • PHP: single quotes; only \\ and \' are escaped.

Limits

  • Emoji are written as a pair of \u codes, as JSON and JavaScript expect.
  • An incomplete code such as \u12 is shown with its position when unescaping.

Privacy

What you type stays in your browser. Nothing is uploaded or saved on the server.

Questions

Why did 👋 become two codes?

JSON and JavaScript write characters above \uFFFF as a surrogate pair.

Do I need the quotes when unescaping?

No, they are optional.

Is the text run?

No.

Is the text uploaded?

No.

Related tools

All tools