Skip to content

Escape & Unescape

Escape and unescape strings for JSON, JavaScript, XML, CSV, SQL, Java and C#.

Available tools

JSON String EscapeEscape text for use inside a JSON string: quotes, backslashes, newlines and control characters, optionally ASCII-only.JSON String UnescapeTurn an escaped JSON string (with or without surrounding quotes) back into plain text, reporting invalid escapes.JavaScript String EscapeEscape text for a JavaScript string literal in single, double or backtick quotes, including \x, \u and U+2028 handling.JavaScript String UnescapeDecode JavaScript escape sequences such as \n, \x41, \u00e9, \u{1F600} and legacy octal escapes into plain text.XML EscapeEscape the five XML special characters (& < > " ') so text is safe in XML element content and attributes.XML UnescapeDecode XML entities (&amp; &lt; &gt; &quot; &apos;) and numeric character references back to plain text.HTML EscapeEscape & < > " and ' so untrusted text can be safely inserted into HTML pages and attributes.HTML UnescapeConvert escaped HTML (&lt;p&gt;, &amp;, &copy;, &#8364;) back to the original characters and markup.CSV EscapeQuote a value for CSV per RFC 4180: wrap fields containing delimiters, quotes or line breaks and double inner quotes.CSV UnescapeRemove CSV quoting from a field: strip surrounding quotes and turn doubled quotes ("") back into single quotes.SQL String EscapeEscape text for an SQL string literal by doubling single quotes, or with MySQL backslash escapes.SQL String UnescapeTurn an SQL string literal back into plain text: strip quotes and collapse '' (or MySQL backslash escapes).Java String EscapeEscape text for a Java string literal: backslashes, quotes, \n, \t and control characters, optionally as \uXXXX ASCII.Java String UnescapeDecode Java string escapes (\n, \t, \s, \uXXXX, octal) into plain text, flagging escapes Java would reject.C# String EscapeEscape text for C# regular ("…") or verbatim (@"…") string literals, including \0, \a, \v and \uXXXX.C# String UnescapeDecode C# string escapes (\n, \x41, \u00e9, \U0001F600) or verbatim @"…" strings back to plain text.Regex EscapeEscape regular-expression metacharacters (. * + ? ^ $ ( ) [ ] { } | \ /) so text matches literally.