Backslash Escape & Unescape

JSON Strings

Escape or unescape quotes, newlines, and tabs for JSON string values or general text. Live conversion in your browser.

This conversion runs only in your browser — nothing is uploaded.

JSON string escapes \ " \n \r \t only (no \'). General also escapes apostrophes and \0. Not a JSON document validator.

  • Input0
  • Output0
  • OptionsJSON string

Input

Output

What is this tool?

This tool escapes special characters into visible backslash sequences, or turns those sequences back into real characters. Pick JSON string for values you will paste into JSON (and many config formats), or General text when you also need apostrophe (\') and null (\0) escapes.

It is not a JSON document validator and it does not implement every language’s escape grammar (regex, shell, SQL each differ). Use it to prepare a string literal, inspect logs, or undo accidental double-escaping.

Common use cases

  • Insert a multi-line note or path with quotes into a JSON config field
  • Clean log lines that show \n and \" so you can read the original text
  • Prepare a string value for YAML/JSON settings without hand-editing escapes

How to use

  1. Choose Escape or Unescape. Results update live as you type.
  2. Select JSON string or General text — changing the option re-runs immediately.
  3. Paste plain text (escape) or an already-escaped string (unescape).
  4. Copy the output. Escape only once for the target format.

Examples

Input / settingOutputNotes
He said "hi" → JSON EscapeHe said \"hi\"Double quotes for a JSON string value.
It's ok → JSON EscapeIt's okApostrophe left alone (valid inside JSON "…").
It's ok → General EscapeIt\'s okGeneral also escapes '.
line1 + newline + line2 → Escapeline1\nline2Newlines become \n.
He said \\\"hi\\\" → Unescape onceHe said \"hi\"Over-escaped input; one Unescape peels one layer.

Practical pitfalls

  • Over-escaping: running Escape on text that is already escaped turns \" into \\\", which breaks JSON parsers and config loaders. Unescape first, or paste the raw value once.
  • JSON string mode does not produce \'. If a consumer rejects \', switch to JSON string instead of General.
  • This page does not validate full JSON documents, regex patterns, or shell quoting rules.

References

Last reviewed: 2026-07-26

Frequently asked questions

Is this a JSON validator?
No. It only escapes or unescapes characters inside a string value. It does not parse objects, arrays, trailing commas, or full JSON documents—use a JSON formatter for that.
What is the difference between JSON string and General text?
JSON string escapes backslash, double quote, newline, carriage return, and tab. General text also escapes apostrophes as \' and null as \0, which many JSON parsers reject.
Why did my string break after escaping twice?
Each Escape pass turns an already-escaped sequence into another layer (for example \" becomes \\\"). Escape once for the target format, or Unescape before re-escaping.
Does the text stay local?
Yes. Escaping and unescaping run only in your browser; nothing is uploaded.