๐Ÿ”’ Runs in your browser โ€” nothing is uploadedโœ“ Free, no signup

String Escape & Unescape

Escape or unescape text for nine languages and formats โ€” JavaScript, Java, C#, JSON, HTML, XML, SQL, CSV and regex โ€” so quotes, backslashes and special characters are safe to paste into code.

0 characters

Escaped string

When should you use the String Escape / Unescape?

  • Pasting text with quotes or Windows paths into a string literal
  • Escaping user text for a SQL statement or CSV cell
  • Matching a literal string with a regular expression

How to use the String Escape / Unescape

  1. 1

    Pick the language

    Choose where the string will be used โ€” JavaScript, Java, C#, JSON, HTML, XML, SQL, CSV or Regex.

  2. 2

    Escape or unescape

    Escape makes text safe for that language. Unescape reverses it.

  3. 3

    Paste your text

    The result updates as you type.

  4. 4

    Copy

    Copy the result into your code.

Examples

Same text, different languages

Text

It's "done" โ€” C:\temp

Escaped

JavaScript  It\'s \"done\" โ€” C:\\temp
SQL         It''s "done" โ€” C:\temp
Regex       It's "done" โ€” C:\\temp

Common errors and how to fix them

SQL injection worries
Escaping helps, but always use parameterised queries or prepared statements in real applications instead of building SQL strings by hand.
Unescape changed nothing
Make sure the language matches how the text was escaped โ€” SQL uses doubled quotes ('') while JavaScript uses backslashes.
Related tools:ย JSON Escape / Unescape ยท HTML Entity Encoder / Decoder ยท URL Encoder & Decoder

More from Encoding & Security

Free tools that run in your browser โ€” no signup, nothing uploaded.

String Escape / Unescape FAQ

Characters like quotes and backslashes have special meaning inside a string literal. Escaping marks them as plain characters so they don't end the string or start an escape sequence.

Standard SQL escapes a single quote by doubling it: O'Brien becomes O''Brien. Use prepared statements in application code โ€” they handle this for you and prevent SQL injection.

Values that contain commas, quotes or line breaks are wrapped in double quotes, and any double quote inside is doubled โ€” say "hi", ok becomes "say ""hi"", ok".

It puts a backslash before characters that have special meaning in regular expressions โ€” like . * + ? ( ) [ ] { } | ^ $ โ€” so the pattern matches them literally.

They're very similar. JavaScript also escapes backticks (for template literals) and supports \x and \u{โ€ฆ} escapes; Java uses \uXXXX. Pick the language you're writing.

No. Escaping and unescaping happen in your browser.