jsonecho

CSV Escape

Paste your text and get it escaped for CSV, ready to paste into code or data.

Loading the tool...

How to use CSV Escape

  1. Paste or type the text you want to escape.
  2. Adjust the options if you need to.
  3. Copy the escaped result.

About CSV Escape

A CSV field has to be wrapped in double quotes if it contains the delimiter, a double quote or a line break. Inside the quotes, each double quote is doubled. That is the whole rule, and it is the one that most hand-written CSV exports get wrong, which is why files fall apart when someone enters a comma in a name field.

Paste your text and the tool applies that rule. By default the whole input is one field. If each line is a separate value, tick "Treat each line as a field".

What gets escaped

A field is wrapped in double quotes when it contains the delimiter, a quote or a line break. Every double quote inside becomes two double quotes.

Frequently asked questions

When are quotes really required?

When the field contains the delimiter, a double quote or a line break. Leading or trailing spaces are another case where quoting is safer, and the tool quotes those too.

Why does Excel in Europe want semicolons?

Because the comma is the decimal separator in those locales. Set the delimiter to semicolon when the file is for a German, French or Turkish Excel.

How do I include a line break in a field?

Wrap the field in quotes and keep the line break inside. Most importers read it as part of the field.

What is the standard for CSV?

RFC 4180 describes it, but it is a description of common practice rather than a strict rule, which is why dialects differ.

More in Escape and Text

All tools →