Escape and unescape strings for JavaScript, HTML, URLs, JSON, and SQL — live as you type, with clear error messages when a value can't be safely reversed.
Every text-based format — a programming language, a markup language, a data-interchange format, a query language — needs certain characters to carry structural meaning: quotes to delimit strings, angle brackets to delimit tags, ampersands to delimit query parameters. The moment your actual content happens to contain one of those special characters, there's an ambiguity: does this quote end the string, or is it part of the text? Escaping resolves that ambiguity by using a distinct, unambiguous representation for special characters when they appear as literal content — a backslash-prefixed sequence, an HTML entity, a percent-encoded byte, a doubled quote — so a parser can always tell structure apart from content, no matter what the content contains.
JavaScript string literals are delimited by single quotes, double quotes, or backticks, and need any of those same delimiter characters escaped if they appear inside the string, along with the backslash character itself (since backslash is the escape character — an unescaped backslash would be read as the start of an escape sequence). Whitespace control characters like newline, tab, and carriage return also need escaping, both because raw line breaks aren't allowed inside most string literal forms and because escaped versions make the string's content unambiguous and readable on a single line of source code. JSON, which was deliberately designed as a strict subset of JavaScript object literal syntax, inherits this same escaping approach but with an even smaller, tightly-specified set of allowed escape sequences — which is exactly why this tool routes JSON conversion through the browser's native, spec-compliant JSON engine rather than a custom implementation.
HTML uses angle brackets to delimit tags and ampersands to introduce entities, which means any literal < or & in your content needs to be escaped — otherwise a browser will try to parse it as the start of a tag or an entity reference rather than displaying it as visible text. Quote characters technically only need escaping inside attribute values (where they delimit the attribute), but escaping them everywhere is the safe, conventional default this tool follows, since it produces correct output in every context without needing to reason about where the text will be inserted. This is precisely the mechanism that prevents a user-submitted comment containing '<script>' from being executed as code when it's later displayed on a page — a foundational, decades-old defense against cross-site scripting (XSS).
URLs can only safely contain a limited set of characters directly — letters, digits, and a handful of punctuation marks — because characters like spaces, ampersands, and question marks carry structural meaning in a URL (separating the path from the query string, or one query parameter from the next). Percent-encoding replaces any other character with a % followed by its two-digit hexadecimal byte value, which is why a space becomes %20 and an ampersand becomes %26. SQL string literals use a completely different mechanism — since a single quote is the only character that delimits a SQL string, the only character that strictly needs escaping is that same single quote, done by doubling it (''), which is the ANSI SQL standard approach supported by every major relational database.
String Escape/Unescape makes raw text safe to embed in code, markup, and queries. These related tools handle other common encoding tasks.