Last updated
Quick Reference: RFC 4180 Escaping Rules
- If a value contains a comma, newline, or double quote — enclose the entire value in double quotes
- If a value contains double quotes — replace each
"with""(two double quotes) - Leading and trailing spaces inside quotes are preserved as part of the value
- The last record may or may not have a trailing newline
Use the CSV Escape/Unescape tool at techconverter.me to correctly escape values for CSV, unescape CSV fields to extract raw values, and diagnose escaping issues in malformed CSV data.
Examples
Example 1: Value Containing a Comma
A value that contains the delimiter character must be enclosed in double quotes:
/* Raw value */
New York, NY
/* Escaped for CSV */
"New York, NY"
/* Full CSV row */
id,name,city
1,Alice Johnson,"New York, NY"
2,Bob Smith,"Chicago, IL"
Without the quotes, the comma inside the value would be interpreted as a field separator, splitting the value into two columns and corrupting the entire row.
Example 2: Value Containing Double Quotes
Per RFC 4180, double quotes inside a quoted field are escaped by doubling them:
/* Raw value */
She said, "Hello World"
/* Escaped for CSV */
"She said, ""Hello World"""
/* Full CSV row */
id,message
1,"She said, ""Hello World"""
2,"The product is called ""Widget Pro"""
Paste the raw value into the escape tool and get the correctly escaped version instantly, without manually counting and doubling quotes.
Example 3: Value Containing a Newline
Multi-line values (containing line breaks) must be enclosed in double quotes:
/* Raw value (two lines) */
Line one
Line two
/* Escaped for CSV */
"Line one
Line two"
/* Full CSV row */
id,notes
1,"Line one
Line two"
2,Single line note
Many CSV parsers handle multi-line fields correctly when they are properly quoted. The tool ensures the quoting is applied correctly so parsers don't treat the embedded newline as a row separator.