CSV formatter and validator
Check a CSV file for broken quotes and rows with the wrong number of fields, then rewrite it with consistent quoting.
Runs in your browser. Your input is not uploaded.
Loading the tool…
What it does
A CSV file is valid when every quoted field is closed, quotes inside a field are doubled (""), and every row has the same number of fields as the header. Spreadsheets are forgiving about all three, so a file that opens in Excel can still break an import script.
This tool parses the file with RFC 4180 rules, reports the first broken quote with its line, lists rows whose field count differs from the header, and writes the data back out with quoting applied only where it is needed, or on every field.
How to use it
- Paste CSV or open a
.csvor.tsvfile. The delimiter is detected, or choose it. - Read the warnings: each one gives the line number to fix.
- Choose the output delimiter, quoting and line endings, then copy or download.
Example: semicolon file to comma-separated
Input
id;name;city 1;"Smith, John";Sydney
Output
id,name,city 1,"Smith, John",Sydney
Things to watch for
- Line numbers count physical lines in the file, so a quoted field with a line break inside it moves later rows down.
- Blank lines are dropped from the output.
- Trim spaces removes spaces at the start and end of every field, including inside quoted fields where they may be intended.
Questions
- What makes a CSV file invalid?
- An opening quote with no closing quote, a quote in the middle of an unquoted field, or rows with a different number of fields from the header. The first two stop parsing; the third is reported as a warning so you can still see the data.
- How do I change a CSV delimiter from semicolon to comma?
- Paste the file, check that the input delimiter shows semicolon, and set Output delimiter to Comma. Fields that contain a comma are quoted automatically.
- Should I quote every field?
- Only if the program reading the file needs it. RFC 4180 requires quotes only around fields that contain the delimiter, a quote or a line break.
- Which line endings should I use?
- RFC 4180 specifies CRLF, and some older Windows tools expect it. Most modern tools accept either; LF is the default here.