CSV Dialect Sniffer

Which delimiter is this file? With the evidence.

  • Scores every delimiter
  • Lists ragged rows
  • Reads on your device
A round clay tray on a pale surface, divided by thin clay walls into several empty rectangular compartments of different widths, lit by soft daylight.

The guide

A delimited file carries no label, so its separator has to be worked out from evidence

Commas, semicolons, tabs and pipes all pass for a CSV file. Quotes, line breaks and the decimal mark decide which one a file really uses.

  • 0.75 score of the comma on a semicolon file with a plain header
  • 4 records in a five-line comma sample, because one field holds a line break
  • 0.8 share of a ragged sample's records that have the usual 3 fields
  • 0.05 gap between top scores at which the answer is called uncertain
  • 5 MB file cap, read in 1 MB slices with no upload
Read the full guide Fold the guide 7 min · 12 sources

A file that ends in .csv promises little. It does not say which character separates the fields, whether a field may hold a line break, or which line ending closes a record. The rest is found by reading.

That is why the name is slippery. Comma-separated values is one member of a larger family, delimiter-separated values, and the family is a category of format rather than a single format. Any character may serve as the delimiter. Comma, tab, colon, vertical bar and space are the common choices, and a convention has to be agreed before a file means anything to a reader. Tab-separated values, its best known sibling, are described as simple and widely supported for exchanging tables between programs.

Why a delimiter alone is not enough

Pick a delimiter and you meet its problem at once. A field may contain the very character that separates fields, and a reader then splits one value in two. The family names this delimiter collision, and the usual cure is to enclose the value in double quotes so the delimiter inside it is read as text. RFC 4180, the 2005 description of the comma-separated form, states the rules plainly: a field holding a comma, a double quote or a line break should be enclosed in double quotes, and a double quote inside such a field is written as two. Spaces belong to the field, and an unquoted field may not contain a quote at all.

Take five lines of text: id,name,note, then 1,"Smith, A",ok, then 2,"He said ""hi""",fine, then 3,Lee,"two and lines". Split every line on every comma and the field counts run 3, 4, 3, 3 and 1. Read the quotes properly and the file holds 4 records of 3 fields each. The fifth line was never a record; it was the second half of one field. The CSV article says this outright: such data cannot be parsed by splitting it into lines and each line by commas. A reader that ignores quotes will miscount in exactly the files where quotes were needed.

Quotes have a position as well as a meaning. A quote opens a quoted field only at the very start of a field. A quote in the middle of an unquoted word is just a character, and a closing quote followed by more text is a mistake. The page treats each of these as evidence to report, not as something to repair silently, because a repair is a guess about what the writer meant. The CSV article also warns that some programs do not support a line break inside a field even when it is quoted, and that a double quote may be parsed wrongly.

Consistency is the evidence

RFC 4180 asks that each line contain the same number of fields throughout the file. The W3C model for tabular data says the same in its best-practice section. That small rule is the whole lever. If a file really is separated by one character, splitting on that character gives nearly every record the same count. Splitting on any other character gives scattered counts, or one field per record.

So the page tries each candidate in turn: comma, semicolon, tab and pipe. For each it reads the first 1,000 records with the quote-aware rule above, counts the fields in every record, and takes the most common count. The score is the share of records that have that count. A score of 1.0 means every record agrees.

One more condition is needed, and it is easy to miss. The most common count must be at least 2. Take the character | in a file that never uses it: every record has one field, the share is 1.0, and the score looks perfect. A candidate that splits nothing proves nothing, so it is not allowed to win.

Here is a worked case you can load with the Semicolon button. The text is id;price;qty, then 1;2,50;4, 2;3,75;1 and 3;10,00;7. On the semicolon every record has 3 fields, so the score is 1.0. On the comma, the header has no comma and gives 1 field, while each row has one decimal comma and gives 2. The most common count is 2, in 3 of 4 records: a score of 0.75.

The gap of 0.25 is real but small. It exists only because the header carries no number, and blank cells in a price column would widen it. The margin measures the file, not the format.

The winner is the most consistent delimiter, not the one that makes the most fields. A note column full of unquoted prose can hold several commas per row and still be one field of a semicolon file. A rule that crowned the highest field count would pick the comma there, and the answer would be wrong precisely where a person would look for help.

When two candidates score within 0.05 of each other, the page says the answer is uncertain and shows both. The text name,city;code over two data lines splits cleanly on the comma and cleanly on the semicolon. Nothing in the characters can settle that, and a confident verdict would be invented.

Why a semicolon appears at all

Both the comma and the full stop are accepted decimal marks. The Decimal separator article reports that the General Conference on Weights and Measures declared in 2003 that the marker shall be either the point or the comma, and that ISO 80000-1 says the same. Its list of places that write a decimal comma includes the Netherlands, Poland, Portugal and Romania, though the list carries a notice about regional detail.

In such a place a price is written 2,50. The comma now has two jobs, and a comma-delimited file would cut every price in two unless each one were quoted. The W3C model notes that numbers in tabular data are often formatted for people, which may mean commas as decimal points. A semicolon avoids the clash.

I found no source that says which programs choose a semicolon or why, so treat that last step as reasoning rather than record. One supporting observation is in the CSV article: a widely used spreadsheet dialect does not insist on a comma as the separator. That is consistent with the reasoning, though it does not prove it.

Locale makes the same data write differently. The MDN page for Intl.NumberFormat shows that the German setting uses a comma as the decimal separator and a period for thousands. The Decimal separator article adds that most operating systems let the user choose the mark, that carefully internationalized programs follow the choice, and that some ignore it.

The page flags a decimal comma only under a narrow rule. The winner must be a semicolon, and at least half of the cells in a column must read digits, a comma and digits. In the worked file the price column qualifies with 3 of 4 cells, counting the header as a cell, because nothing in the text can say whether a first row is a header.

What the text cannot tell you

That header question is real. RFC 4180 calls the header line optional and gives no way to test for one, and the CSV article repeats the warning that a program may take the header for data. The page counts the first row as a record like any other and does not guess.

The encoding is equally unknowable. The CSV article says the format is not limited to one character encoding and offers no way to state it. The W3C model recommends UTF-8. A file may begin with a byte order mark, the character U+FEFF; in UTF-8 its bytes are always EF BB BF, as RFC 3629 notes, and software that does not expect non-ASCII bytes at the start of a file can be confused by it. The page reports a mark and nothing more about encodings.

Line endings vary too. RFC 4180 specifies a carriage return and line feed, and admits that some implementations use other values. The W3C model allows a line feed alone. The Newline article records that protocols from the IETF typically use the pair, while Unix-like systems use a single line feed. A file can mix them, and counting each kind is the only honest way to say so.

A record whose field count differs from the usual one is called ragged. It is a symptom with several causes: a missing cell, a delimiter inside unquoted text, or a quote that never closes and swallows the lines after it. In the sample a,b,c, 1,2, 3,4,5, 6,7,8 and 9,10,11, the comma gives 3 fields in 4 of 5 records, a score of 0.8, and the page lists line 2 with 2 fields.

Reading a large file takes care. The slice() method of a Blob returns a new Blob holding a byte range and leaves the original unchanged, so a file can be read a megabyte at a time without being held whole. A web worker runs script in a background thread, cannot touch the page’s elements, and receives copies of the data it is sent. The page uses both: a 5 MB cap, 1,000 records to choose the delimiter, and a full scan of every record for the ragged list.

None of this converts, cleans or validates the file, and none of it reads minds. It measures how consistently each character splits the records, shows the numbers, and points at the lines that disagree. A delimiter is a convention between a writer and a reader. When the writer is absent, the evidence is all that is left, so the useful answer is the verdict together with the scores behind it.

Sources

Every source consulted for this guide. Links checked November 10, 2026.

  1. Comma-separated values - Wikipedia Wikipedia (CC BY-SA)
  2. Delimiter-separated values - Wikipedia Wikipedia (CC BY-SA)
  3. Tab-separated values - Wikipedia Wikipedia (CC BY-SA)
  4. Decimal separator - Wikipedia Wikipedia (CC BY-SA)
  5. Byte order mark - Wikipedia Wikipedia (CC BY-SA)
  6. Newline - Wikipedia Wikipedia (CC BY-SA)
  7. RFC 4180: Common Format and MIME Type for Comma-Separated Values (CSV) Files RFC Editor (IETF)
  8. RFC 3629: UTF-8, a transformation format of ISO 10646 RFC Editor (IETF)
  9. Model for Tabular Data and Metadata on the Web W3C
  10. Intl.NumberFormat - JavaScript | MDN MDN Web Docs (Mozilla, CC BY-SA)
  11. Blob: slice() method - Web APIs | MDN MDN Web Docs (Mozilla, CC BY-SA)
  12. Web Workers API - Web APIs | MDN MDN Web Docs (Mozilla, CC BY-SA)