NV ToolkitFormat · Validate · Convert

Escape / Unescape

CSV Escape / Unescape

RFC 4180 field escaping — values with commas, quotes, or line breaks wrapped and doubled correctly, and unwrapped just as cleanly.

In short

Escape and unescape CSV field values online per RFC 4180: quote wrapping and doubled quotes for commas, quotes and line breaks in data. Free, instant.

By NaveenKumar T · Updated

Learn: How to Escape a Single Quote in SQL

  • Escape & unescape in one tool
  • Handles every special character
  • Instant as you switch modes

Runs entirely in your browser — nothing you paste or open here is uploaded, logged, or stored.How we handle data →

Example

CSV Escape: input and output

A two-line customer review being written into one CSV cell.

Field value
5/5 — "Best value", says Priya
Ships to: Bengaluru, KA 560001
Escaped CSV field
"5/5 — ""Best value"", says Priya
Ships to: Bengaluru, KA 560001"

The whole input became one field: it was wrapped in double quotes because it contains commas, a quote and a line break, and the inner quotes were doubled — the em dash and the slash needed nothing.

Learn more

CSV escaping rules

CSV's escaping is deceptively simple and famously mis-implemented: a field containing commas, double quotes, or line breaks must be wrapped in double quotes, and any quote INSIDE it doubled (" becomes ""). That's the whole RFC 4180 rule — and hand-rolled split(',') code violates it constantly, shearing addresses and quoted names into extra columns.

Escape mode applies the rule to a value (leaving clean values untouched, as the spec intends); Unescape mode unwraps and un-doubles. For whole files rather than single fields, the CSV to JSON converter parses complete documents with the same correctness.

RFC 4180: the whole quoting rule in one table

RFC 4180 gives CSV its only real specification, and the field-quoting rule is short enough to memorize: quote a field if — and only if — it contains a comma, a double quote, or a line break; leave every other field bare. Escape mode applies exactly this, which is why a plain word or number comes back unchanged.

RFC 4180 field-quoting rule
Field containsOutput
No comma, quote, or line breakWritten unquoted, exactly as-is: Bengaluru
A commaWrapped in double quotes: "Bengaluru, KA"
A double quoteWrapped in quotes, and each " doubled: "5' 5"" tall"
A line break (CRLF or LF)Wrapped in quotes with the newline kept inside: "Line one Line two"

Help

Frequently asked questions

Everything you need to know about the CSV Escape.

01How do I escape or unescape CSV here?

Paste a field value, pick Escape or Unescape in the Mode select, and press Convert. Escape wraps the value in quotes and doubles any inner quotes only when a comma, quote or line break is present, per RFC 4180; Unescape unwraps and un-doubles a quoted field.

02My value has no comma — why might it still need quoting?

Line breaks and double quotes also trigger quoting, and they hide well: an address pasted from a form carries an invisible newline; a nickname carries quotes. The tool checks all three conditions, which is exactly why escaping by eye eventually fails.

03If I paste several lines, do they become several fields?

The whole input is treated as one field value, multiple lines included. A line break is simply one of the three things that force quoting (with a comma and a double quote), so a two-line address becomes a single quoted field with the newline kept inside it. Semicolons, tabs and pipes never trigger quoting, because RFC 4180 is comma-only; quote those by hand if your file uses another delimiter. Unescape returns an unquoted value unchanged apart from trimming.

Keep working

Related tools

Learn the format

Related guides

All guides →