Saved

Press the star next to a tool's name to save it.

All my tools

CSV Validator (RFC 4180 Check with Line Numbers)

This CSV validator checks your file against RFC 4180 and lists every problem with its line number: unclosed or stray quotes, rows with the wrong number of columns, and empty or duplicate headers. It runs in your browser.

Restored your last values ·

Line numbers refer to the lines in the text you paste. Quoted fields may span several lines.

Everything is checked in your browser. Your data is never uploaded.

Result

Paste some CSV to check it.

Recent results

A CSV file looks simple until one stray quote or one missing comma makes an import fail with a vague error. This CSV validator reads your data the way the CSV standard describes it and tells you exactly which line is wrong and why. Paste the file, press Check, and you get a pass or a list of problems with line numbers.

What the CSV validator checks

The only formal description of CSV is RFC 4180, published in 2005 to replace a loose, informal habit that had been in use for decades. [2] The tool checks your text against its rules: [1]

  • Same number of fields on every line. The RFC says each line should contain the same number of fields. The first record sets the expected count, and any record that differs is reported with both numbers.
  • Quotes close. A field that opens with a double quote must close with one. An unclosed quote is reported at the line where it opened, because everything after it would be swallowed into one giant field.
  • No stray quotes. A field that is not wrapped in quotes may not contain a double quote. Inside a quoted field a literal quote is written as two quotes in a row.
  • Nothing after a closing quote. Text such as "abc"def is not valid.
  • Header names. If you tick the header box, empty column names and duplicated names are reported.

Spaces are part of the field. That matters in one common mistake: a comma followed by a space and then a quote, as in 1, "x". Because the quote is no longer the first character of the field, the RFC treats it as a stray quote. [1]

Quoted fields and line breaks

Fields that contain commas, line breaks or double quotes should be wrapped in double quotes, and a quoted field may span several lines. [1] The validator follows that rule, so a record that continues over three physical lines still counts as one record. Line numbers in the results are physical lines in your text, so you can jump straight to them in an editor.

Delimiters

Despite the name, not every file uses commas. Semicolons are common where the comma is the decimal separator, and tab-separated and pipe-separated files are everywhere. The format has no way to say which one it uses. [2] Leave the delimiter on Auto and the tool picks whichever of comma, tab, semicolon or pipe appears most often on the first line, ignoring any inside quotes. If the guess is wrong, pick the delimiter yourself.

Notes that do not fail the file

Three things are reported as notes, not as errors, because many programs accept them:

  • Byte order mark. A hidden character at the very start of the file. Some programs show it as odd characters in the first header.
  • Mixed line endings. A file that mixes CRLF, LF and bare CR line breaks. The RFC specifies CRLF, but most readers tolerate the others. [1]
  • Blank lines. An empty line between records. Some importers treat it as a record with one empty field, which then fails the column count.

How to use it

  1. Paste your CSV into the box. You can paste up to ten million characters.
  2. Keep the delimiter on Auto, or choose one.
  3. Tick or untick the header option depending on whether the first line holds column names.
  4. Press Check. A green result means no problems; otherwise the table lists each one.
  5. Fix the first problem and check again, since one unclosed quote can cause several knock-on errors below it.

Common errors and what they mean

MessageUsual cause
Unclosed quoteA field opened with a quote and never closed it, or a quote inside the text was not doubled.
Stray quoteA quote appears inside a field that does not start with one, for example 5" pipe.
Fields do not matchA row has an extra comma, or a comma inside text that was not quoted.
Text after closing quoteA value like "abc"def, often from joining two quoted values by hand.
Duplicate headerTwo columns share a name, so tools that read by name will lose one.

Why strict checking matters

A single bad row can do real damage. A database import may stop halfway and leave only part of the data loaded. A script that splits each line on commas will quietly shift every later column when a value contains an unquoted comma, so a price lands in the name column and nobody notices until the report looks wrong. Checking the file before you import it takes a few seconds and catches these problems while the source is still at hand.

The validator also helps when you build CSV yourself. If you generate a file from code, paste a sample here to confirm that your quoting logic handles commas, quotes and line breaks correctly before you send the file to a customer or another system.

Tips for clean CSV

  • Always wrap text that may contain commas, quotes or line breaks, such as addresses and comments, in double quotes.
  • Double any quote inside a quoted field: write "He said ""hi""".
  • Keep one header row with unique, non-empty names.
  • Save as UTF-8, since CSV has no way to record the encoding. [2]
  • Open the raw text in a plain editor if a spreadsheet hides the problem, because spreadsheets often fix errors silently.

The check runs entirely in your browser. Your data is never uploaded, so it is safe to paste files that contain private records.

What next

Use this often? Add CSV Validato to your Home screen.

Frequently asked questions

What does the CSV validator check?

It checks that every record has the same number of fields, that quotes open and close properly, that unquoted fields hold no quotes, that nothing follows a closing quote, and optionally that header names are filled in and unique.

Why does my CSV fail when it opens fine in a spreadsheet?

Spreadsheets often repair problems silently, such as an unclosed quote or a short row. Other programs and databases are stricter, so the validator reports what they would reject.

How are line numbers counted?

They are physical lines in the pasted text. A quoted field that spans several lines advances the count, so you can jump to the line in an editor.

Can it check semicolon or tab separated files?

Yes. Leave the delimiter on Auto, or pick comma, tab, semicolon or pipe yourself.

Does a byte order mark make a CSV invalid?

It is reported as a note, not an error. Many programs accept it, but some show it as stray characters in the first header name.

Is my data uploaded?

No. The check runs entirely in your browser.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Developer Tools