Escape & Unescape Tools
Escape special characters so text can be placed safely inside a string literal, markup or a data file, or reverse the process to read escaped text.
Popular Escape & Unescape Tools
- JSON EscapeEscape special characters in JSON strings.
- HTML EscapeEscape special characters in HTML strings.
- JavaScript EscapeEscape special characters in JavaScript strings.
- SQL EscapeEscape special characters in SQL strings.
- CSV EscapeEscape special characters in CSV strings.
- XML EscapeEscape special characters in XML strings.
All Escape & Unescape Tools (16)
- HTML EscapeEscape special characters in HTML strings.
- HTML UnescapeUnescape HTML strings back to plain text.
- XML EscapeEscape special characters in XML strings.
- XML UnescapeUnescape XML strings back to plain text.
- JavaScript EscapeEscape special characters in JavaScript strings.
- JavaScript UnescapeUnescape JavaScript strings back to plain text.
- Java EscapeEscape special characters in Java strings.
- Java UnescapeUnescape Java strings back to plain text.
- .NET EscapeEscape special characters in .NET strings.
- .NET UnescapeUnescape .NET strings back to plain text.
- JSON EscapeEscape special characters in JSON strings.
- JSON UnescapeUnescape JSON strings back to plain text.
- CSV EscapeEscape special characters in CSV strings.
- CSV UnescapeUnescape CSV strings back to plain text.
- SQL EscapeEscape special characters in SQL strings.
- SQL UnescapeUnescape SQL strings back to plain text.
About Escape & Unescape
Every language or format has characters that end or change the meaning of a string. In HTML and XML these are <, >, & and quotes, written as entities. In JavaScript, Java, C# and JSON string literals they are the quote, the backslash and control characters such as newlines, written as backslash escapes. CSV doubles quote characters inside a quoted field, and SQL doubles single quotes.
Escaping is about correct syntax. It is not a complete security control: use parameterised queries for SQL and context-aware output encoding in templates.
Which tool to use
Pick the tool for the place the text is going: HTML Escape for text shown on a web page, JSON Escape for a value inside a JSON document, CSV Escape for one spreadsheet cell, and SQL Escape for a string literal typed into a query console. The JavaScript, Java, .NET and JSON tools share the backslash style but follow each language's own list of escapes: JavaScript also escapes backticks and ${, Java writes non-ASCII characters as \uXXXX, C# adds \a and \v, and JSON accepts only its eight escapes. The XML tools use XML's five entities and reject characters XML forbids, while the HTML tools follow the HTML standard.
Frequently asked questions
Is escaping the same as encoding?
They overlap. Escaping makes text valid inside a specific syntax, such as a string literal. Encoding, such as Base64 or URL encoding, transforms data so it can travel through a system.
Does SQL escaping prevent SQL injection?
Doubling quotes is not a reliable defence on its own. Use parameterised queries or prepared statements.
Why are the JavaScript, Java, .NET and JSON escapes so similar?
They share the C-style backslash syntax for quotes, backslashes and control characters, but each language has its own list of escapes. Each tool here follows its own language: JavaScript Escape also escapes backticks and ${ for template literals, Java Escape writes non-ASCII characters as \uXXXX, .NET Escape uses C#'s \a and \v, and JSON Unescape rejects escapes JSON does not define. Each page lists its exact rules.
Common use cases
- Embedding JSON or multi-line text in source code
- Showing code samples as text on a web page
- Preparing a value for a CSV cell that contains commas or quotes
- Reading a log line full of \n and \" sequences
Example
Text: He said "hi"
JSON: He said \"hi\"
HTML: He said "hi"
SQL: It''sThe same idea, written with each format's own escape rules.