Skip to content
Marvin's Toolbox.

Search tools

Type to filter all tools

String Escaper

Escape or unescape a string for JSON, JavaScript, regex, shell, SQL, CSV, XML and more. Paste text, pick the target format and copy the result, in either direction.

Everything runs locally in your browser. Your data never leaves your device.

Conversion

Backslashes, double quotes and control characters become JSON escapes like \n and \u0000, ready to paste inside a JSON string.

Next steps

Send this tool's output straight into another tool.

Convert text into every case at once: title case in the APA, AP, Chicago, MLA, Bluebook, AMA and NYT styles, sentence case, upper, lower, camelCase, snake_case, kebab-case and more.

Count words, characters, sentences, paragraphs, lines and more as you type, with estimated reading and speaking time.

Remove duplicate lines from a list or text, keeping the first occurrence. Optionally ignore case and whitespace, or drop blank lines too.

Replace text in two modes: plain find and replace all, or regular expressions with flag controls and capture group references like $1.

Compare two texts and see every added, removed and changed line highlighted, side by side or inline, with the changed words marked within each line. Ignore case, whitespace or blank lines, read a summary of how much changed, and export the result as a unified diff.

Paste a UUID to see what it carries: version, variant, and for time-based versions the exact timestamp, clock sequence and node. Also shows the raw bytes, the 128-bit integer and the URN form.

Decode Base64 to text or encode text to Base64. Paste into the top box, read the result below, and flip the direction with one click. Handles Unicode correctly, reads URL-safe Base64, and shows binary payloads as a hex dump you can download.

Convert numbers between binary, octal, decimal, hexadecimal and any base up to 36. Type into any field and the others update as you go. Handles huge integers without losing precision and accepts 0x, 0b and 0o prefixes.

Convert between scientific notation and full numbers as you type. Reads 1.23e5, 1.23 × 10^5 and plain numbers, shows the value written out, in normalized scientific notation and in engineering notation, and can round to any number of significant digits.

About the String Escaper Tool

This tool escapes a string for the format you are pasting it into, or turns an escaped string back into plain text. Pick JSON, JavaScript, C, regex, shell, SQL, CSV or XML and the result updates as you type, in either direction.

Each format brings the options that matter for it. Choose single, double or template quotes for JavaScript, single or double quotes for SQL, the delimiter and quoting mode for CSV, and whether the result comes wrapped in its quotes, ready to paste as a whole literal.

What you can do

  • Escape a string for JSON, including quotes and control characters.
  • Escape or unescape a JavaScript string literal in single, double or template quotes.
  • Escape regex metacharacters so text matches itself literally in a pattern.
  • Quote a string safely for bash and other POSIX shells.
  • Escape single quotes for SQL by doubling them, for values and identifiers.
  • Quote a CSV field so commas, quotes and line breaks survive.
  • Escape XML special characters or decode entities and numeric references.
  • Unescape C strings, including octal, hex and unicode escapes.

How to use the String Escaper

  1. 1Pick Escape or Unescape and the target format.
  2. 2Adjust the format's options, like the quote style or the CSV delimiter, if you need to.
  3. 3Paste or type your text into the input pane. The result updates as you type.
  4. 4Copy or download the result, or press Swap with result to convert it back.

What each format escapes

JSON and JavaScript turn backslashes, quotes and control characters into backslash escapes. The JavaScript mode only escapes the quote style you picked, so a single-quoted string keeps its double quotes readable, and template style leaves newlines literal and escapes ${ instead. C works the same way and writes remaining control characters as octal escapes like \033.

Shell quoting wraps the text as one safe word. Single quotes are the bulletproof POSIX form, where a quote inside becomes '\'', and double quotes keep the text readable by escaping $, backticks, " and \. SQL doubles the quote character, the standard every major database understands. CSV doubles inner quotes and wraps the field when it contains the delimiter, quotes or line breaks. XML swaps the five reserved characters for their predefined entities.

Unescaping without surprises

Unescape mode reads escapes strictly and tells you what is wrong instead of guessing. A trailing backslash, an unterminated shell quote, a lone quote in a SQL string or an unknown escape like \q produces a clear error with its position, and nothing is silently dropped. Regex unescaping only removes backslashes from metacharacters, so escapes with their own meaning, like \d, keep it.

Pasted literals can keep their surrounding quotes. A JSON string that still has its double quotes, a JavaScript literal in any quote style or a quoted SQL value is unwrapped automatically. For percent-encoded URLs use the URL Encoder & Decoder, for the full HTML entity set use the HTML Entity Encoder & Decoder, and for Base64 use the Base64 Encoder & Decoder tool.

Decode Base64 to text or encode text to Base64. Paste into the top box, read the result below, and flip the direction with one click. Handles Unicode correctly, reads URL-safe Base64, and shows binary payloads as a hex dump you can download.

Escape text into HTML entities or decode entities back to plain text. Choose named or numeric entities, escape only the unsafe characters or everything outside ASCII, and read the result live.

Paste anything that looks encoded and this tool works out what was used and undoes it, layer by layer. The whole BaseXX family from Base16 to Base85, binary, URL escapes, HTML entities, ROT13 and gzip, Brotli or Zstandard compression are detected in any combination, and every step of the chain is reported.

Turn any text into a clean URL slug. Transliterates accents and non-Latin scripts to ASCII, with options for the separator, letter case and a length limit. Handles many titles at once, one line per slug.

Encode text for use in URLs or decode percent-escaped strings back to readable text. Choose component, full-URL or form encoding, unwrap double-encoded strings, and break a URL into its parts with every query parameter decoded.

Format code in JavaScript, TypeScript, JSON, JSON5, HTML, Vue, CSS, SCSS, LESS, Markdown, YAML, GraphQL, XML and SQL. Pick tabs or spaces, set the indent width, and format the input in place with one click.