CSV Escape

Escape special characters in CSV strings.

Local Your input is processed locally in your browser. Found a problem? Report an issue

What CSV Escape does

CSV Escape escapes the characters that would otherwise end or break a CSV string or document, so that any text can be placed inside one.

CSV Escape examples

The built-in sample

Input

say "hello" & <b>bye</b>

Output

"say ""hello"" & <b>bye</b>"

This is the input that the Load sample button fills in.

A value with a comma, quotes and a line break

Input

Lovelace, Ada said "hi"
line 2

Output

"Lovelace, Ada said ""hi""
line 2"

The whole input is treated as one field: it is wrapped in quotes and each inner quote is doubled. The line break stays inside the quoted field, which RFC 4180 allows.

Each output was produced by running this tool on the input above it.

How it works

These characters are changed; everything else is left as it is:

CharacterEscaped form
"""""
'"'"
\"\"
<"<"
>">"
&"&"
line break" "
tab" "
control character U+0001"␁"

Details and limits

  • The whole value is wrapped in quotes and inner quotes are doubled, following RFC 4180.
  • This escapes one field, not a row. If you paste a,b, you get one field containing a comma, not two fields.
  • The field is always quoted, even when it would not need quotes. Every CSV reader accepts that.
  • Spreadsheet applications treat a field that starts with =, +, - or @ as a formula, even when it is quoted. This tool does not neutralise such values.

Questions

Is my data uploaded when I use CSV Escape?

No. The tool runs in your browser, so what you paste or open is processed on your own device and is not sent to a server.

What does CSV Escape do?

CSV Escape escapes the characters that would otherwise end or break a CSV string or document, so that any text can be placed inside one.

Are there any limits I should know about?

The whole value is wrapped in quotes and inner quotes are doubled, following RFC 4180. This escapes one field, not a row. If you paste a,b, you get one field containing a comma, not two fields.

Is there a size limit?

There is no fixed size limit. Everything happens on your device, so very large inputs depend on its memory and can take longer on a phone than on a computer.

Does it work on phones, and is it free?

Yes. It works in any current browser on Android phones, iPhones, tablets and computers. It is free and needs no account or sign-up.