String Escaper

Escape and unescape strings for JSON, JavaScript, and source code.

How it works

Convert raw text with newlines and quotes into escaped strings ready for JSON or JavaScript, or unescape an escaped string back to plain text.

Example: a real newline becomes \n and " becomes \", ready to paste into code.

Input
Output