Text Escape / Unescape

Escape or unescape strings for JavaScript, HTML, URL encoding, and JSON.

Escaping and Unescaping Notes


Escaping protects literal text when inserted into formats like JSON, HTML, or shell commands where special characters have meaning.

  • Escape before embedding user text into templates or structured payloads.
  • Unescape output when debugging logs copied from encoded contexts.
  • Choose the correct mode for the target format to avoid double escaping.

Text Escape FAQ


What causes double-escaped output?

Running escape repeatedly on already escaped text adds extra escape characters.

When should I unescape data?

Unescape when you need readable text for debugging or display in plain contexts.

Is escaping the same as sanitizing?

No. Escaping is format-specific encoding, while sanitizing removes unsafe content.

Wikipedia — Escape character