JS String Escaper
Escape text for safe use inside JavaScript or JSON string literals.
Runs locally · Nothing uploaded
Plain text
Escaped string
Result will appear here…Advertisement
About JS String Escaper
Escapes quotes, backslashes, newlines, tabs, and control characters so the result can be pasted between quotes in JavaScript or JSON without breaking the literal. Also useful for embedding multi-line text in a single-line string. The same escaping rules make output valid inside JSON strings.
Related tools
EncodingRuns locally in your browser.JS String UnescaperInterpret escape sequences like \n, \t, and \" as real characters.EncodingRuns locally in your browser.HTML Entity EncoderEscape text for safe embedding in HTML markup.EncodingRuns locally in your browser.Unicode EscaperConvert characters to \uXXXX escape sequences.