Handle Quoted Fields Containing Commas

Understand how the converter handles CSV fields that contain commas by wrapping them in quotes, following RFC 4180 quoting rules.

Quoting Rules

Detailed Explanation

Quoted Fields with Commas

When converting TSV to CSV, any field value that contains a comma must be wrapped in double quotes. This is the most common quoting scenario in CSV files and is defined by RFC 4180.

Example TSV Input

Company	Address	Revenue
"Acme, Inc."	"123 Main St, Suite 100"	$1,500,000
"Widget Co."	"456 Oak Ave"	$750,000

Generated CSV Output

Company,Address,Revenue
"Acme, Inc.","123 Main St, Suite 100","$1,500,000"
"Widget Co.",456 Oak Ave,"$750,000"

RFC 4180 Quoting Rules

The standard rules for quoting in CSV are:

  1. If a field contains the delimiter (comma), it must be enclosed in double quotes
  2. If a field contains a double quote, it must be enclosed in double quotes and each internal double quote must be doubled ("")
  3. If a field contains a newline character, it must be enclosed in double quotes
  4. Fields that do not contain any of these special characters may optionally be quoted

Smart Quoting

The converter uses smart quoting — it only adds quotes when necessary. In the example above, "Widget Co." does not contain a comma, so the company name field does not need quoting in the CSV output. However, "456 Oak Ave" also does not need quoting. Only fields with commas, quotes, or newlines get quoted.

Preserving Original Quotes

When the TSV input already contains quoted fields (as shown above), the converter parses them correctly, strips the outer quotes, and re-quotes as needed for the target format.

Use Case

Converting address data, company names, or financial figures that contain commas from a tab-delimited export into proper RFC 4180-compliant CSV files.

Try It — TSV \u2194 CSV Converter

Open full tool