Guide

CSV Delimiters Explained: Comma, Semicolon, Tab, Pipe, and How to Tell Which One You Have

Why your CSV opens in one column or splits numbers in half. Learn how comma, semicolon, tab and pipe delimiters differ, and how to detect and convert them.

The C in CSV stands for comma. In real life, plenty of files called CSV use semicolons, tabs, pipes, or something stranger, and the program that wrote the file rarely tells you which.

You find out when something looks wrong. The whole file lands in one fat column in Excel. Or a price like 12,50 gets chopped into “12” and “50” in two separate columns. Or an import fails with a vague “unexpected number of columns” error. All three are the same problem: the program reading the file guessed a different delimiter from the one the file was written with.

This guide explains what a delimiter is, where each common one comes from, why Excel so often gets it wrong, how to tell which one your file uses, and how to convert from one to another without wrecking the data.

What a delimiter actually does

A CSV file is plain text where each line is a record. Inside a line, a special character marks the boundary between fields. That character is the delimiter.

Here is the same record written four ways:

The same record written with comma, semicolon, tab and pipe delimiters

Nothing about the data changed. Only the separator did. For the file to be read correctly, the reader has to split on exactly the character the writer used.

There’s a second half to the story, which is quoting. If a value itself contains the delimiter, the writer wraps that value in double quotes so the reader doesn’t split it. A name like Smith, John in a comma file becomes "Smith, John". This is how a comma file can safely contain commas. It’s also why splitting a CSV line with a simple “split on comma” in code is a bad idea: it ignores the quotes.

Quotes have a rule of their own. If a quoted value needs to contain a double quote, it’s written twice: "He said ""hello""" is read back as He said "hello". Writers and readers that follow this convention agree on where every field starts and ends, which is why a file with a single unbalanced quote can swallow dozens of lines into one giant field. The delimiter and the quote character are a pair, and a reader needs to know both.

The delimiters you’ll meet, and where they come from

Comma. The default, and the one the name promises. RFC 4180, the closest thing CSV has to a formal description, is about comma-separated values, and most software and APIs expect it. If you’re building a file for another program to read, this is the safe choice.

Semicolon. Common in much of Europe and Latin America, and anywhere the comma is the decimal mark. There, 12,50 is a normal way to write money, so the comma can’t also split fields. Software in those regions uses the semicolon instead. If you receive a file from an accountant in Germany, France or Brazil and it looks odd on your machine, this is the most likely reason.

Tab. Files with a tab between fields are often called TSV, for tab-separated values, with extensions like .tsv or .tab. Tabs rarely appear inside normal text, so TSV is popular for data that contains lots of commas, such as addresses and free text. It’s also what you get when you copy cells from a spreadsheet and paste them into a text editor. Conventions differ on quoting: some tools quote fields, and some simply forbid tabs and line breaks inside values.

Pipe. The vertical bar | appears in exports from older systems and some database dumps, again chosen because it hardly ever shows up in real data.

Others. Carets, tildes and even invisible control characters like the ASCII unit separator turn up now and then, mostly in data pipelines where the author wanted a character that could never collide with the content. You’ll rarely see them in files that people email around.

Why Excel guesses wrong so often

Excel is the usual place the problem shows up, because Excel doesn’t look at your file to decide what the delimiter is. When you double-click a CSV, it uses the list separator from your computer’s regional settings. On a machine set to the US or UK, that’s a comma. On a machine set to Germany, France or Brazil, it’s a semicolon.

That has two consequences:

  • A comma file opened on a “semicolon” computer lands in a single column.
  • A semicolon file opened on a “comma” computer does the same.

The same file can look perfect on your colleague’s laptop and broken on yours, and nobody has done anything wrong.

It works the other way too. When Excel on a decimal-comma system saves a file as “CSV (Comma delimited)”, it writes semicolons, because that’s the local list separator. So a file you receive from a German Excel user may technically be semicolon-delimited even though the dialog said comma.

What a wrong delimiter guess looks like: correct columns, everything in one cell, and a decimal number split into two columns

The picture shows the two typical symptoms. If you see everything in the first column, the delimiter is wrong. If you see numbers split in two, with a decimal comma in a comma-delimited file, you’ve got both problems at once.

How to tell which delimiter your file uses

Don’t guess from the file extension, which says nothing. Look at the actual text.

Open it in a plain text editor. Notepad, VS Code, anything that doesn’t reformat the data. Read the first line. The header names are separated by the delimiter, and it’s usually obvious: id;name;city;total or id,name,city,total. A tab looks like a wide gap, and it’s easier to see if your editor can show invisible characters.

Check that it’s consistent. The real delimiter appears the same number of times on every line, except where quoted fields hide extra ones. A character that appears four times on one line and nine on the next is probably part of the text, not the delimiter.

Let a program count for you. On macOS or Linux (in bash), this prints how many of each candidate appears in the header line:

for d in ',' ';' $'\t' '|'; do
  printf '%s: ' "$d"; head -n 1 export.csv | awk -F"$d" '{print NF-1}'
done

The delimiter with the highest sensible count, matching the number of columns minus one, is your answer.

Or use Python’s sniffer. It looks at a sample of the file and guesses:

import csv

with open("export.csv", newline="", encoding="utf-8-sig") as f:
    sample = f.read(4096)

dialect = csv.Sniffer().sniff(sample, delimiters=",;\t|")
print(repr(dialect.delimiter))

Sniffers are fine for a first guess and not for certainty. They can fail on small samples or files with unusual text, so confirm the answer against the header row.

If you’d rather just look at the file as a table, the CSV viewer opens it in your browser and handles comma, semicolon and tab files with automatic detection. Nothing is uploaded, and if the columns look sensible, the delimiter has been read correctly.

Fixing a file that opened wrong in Excel

You have a few options, from least to most invasive.

Import it properly. Open a blank workbook, go to Data, then From Text/CSV, and select your file. The preview shows a Delimiter dropdown, where you pick comma, semicolon, tab and so on, and watch the columns update. This is the cleanest method, and it also lets you choose the encoding. If accents look wrong, our guide on CSV encoding, UTF-8 and BOM problems will help.

Split the column you already have. If everything is already in column A, select it, go to Data, then Text to Columns. Choose Delimited, tick the right delimiter, and finish. Excel splits the cells in place.

Change the list separator. In Windows regional settings (under Region, then Additional settings), you can set the list separator to a comma or semicolon. Excel will then open matching files directly. It affects every program on the machine, so I’d treat it as a last resort. Menu names vary between Windows versions.

Add a hint line. If you create the file and know your readers use Excel, you can put sep=; as the very first line. Excel reads it as an instruction. Almost everything else reads it as a row of data, which will break imports, so don’t do this for files that go into code or databases.

Google Sheets and LibreOffice make this easier: both show an import dialog where you can pick the separator and watch the preview change.

Telling your tools what to expect

Once you know the delimiter, say so explicitly rather than hoping for auto-detection. Every serious CSV reader has an option for it. In pandas, it’s sep, and if the numbers use decimal commas there’s a matching decimal option:

import pandas as pd

df = pd.read_csv("export_de.csv", sep=";", decimal=",", encoding="utf-8-sig")

With those two settings, 12,50 arrives as the number 12.5, not as text and not as two columns. Add thousands="." if the file also writes 1.234,50 style numbers. Database imports work the same way: PostgreSQL’s COPY and MySQL’s LOAD DATA both let you specify the field delimiter and quote character rather than assuming a comma. A few seconds of configuration there beats a failed import and a mystery error message.

Converting from one delimiter to another

The tempting method is find and replace: change every semicolon to a comma. Please don’t. If any field contains a comma, a plain replace puts commas in places where they now split fields, and if any field contains a semicolon, you’ve changed the data itself. You also lose the quoting that protected the original fields.

The safe method is to parse the file with the old delimiter and write it out with the new one, letting the library handle the quoting:

import csv

with open("export_de.csv", newline="", encoding="utf-8-sig") as src, \
     open("export.csv", "w", newline="", encoding="utf-8") as dst:
    reader = csv.reader(src, delimiter=";")
    writer = csv.writer(dst, delimiter=",")
    writer.writerows(reader)

A field like 12,50 is now written as "12,50" with quotes, because it contains the new delimiter. That keeps it as one cell, which is correct.

Notice what the script does not do: it doesn’t turn 12,50 into 12.50. Changing the delimiter and changing the decimal mark are separate jobs, and mixing them up is a common source of wrong numbers. If you also need dot decimals, convert those columns in a second, deliberate step, and check a few values by hand.

Choosing a delimiter when you create the file

If you are the one writing the file, think about who’ll read it:

  • Sending data to software, an API or a database import: use a comma, quote every field that needs it, and save as UTF-8.
  • Sending to colleagues who use Excel in decimal-comma countries: a semicolon will open correctly for them by double-click. Say so in your email.
  • Text with lots of commas, such as addresses and comments: a tab keeps the file easier to read in a text editor, though you’ll need to watch for stray tabs in the data.
  • Not sure who will open it: use a comma and add a one-line note on how to import it. That’s the format most tools expect.

Whatever you choose, be consistent inside the file, keep one header row, and don’t use a character that appears often in the data.

If a file is going to be reused, write the delimiter down somewhere people will see it: in the file name (orders_semicolon.csv), in the email, or in a short readme next to a shared folder. It sounds fussy, but “which separator is this?” is one of the most common questions people ask about a CSV they didn’t make, and a single line of documentation answers it before anyone has to ask.

If your file also has line breaks inside fields, check that the quoting is intact. Our post on fixing comma and newline errors in CSV fields explains how a single missing quote can shift every column after it.

When it isn’t really a delimited file

Sometimes you find that no delimiter fits, because the file isn’t delimited at all. Fixed-width files line up their columns using spaces, so each field starts at the same character position on every line. Report-style text exports pad columns with runs of spaces for the same reason. Splitting those on a single comma, semicolon or tab won’t work, and splitting on every space will break any value that contains one.

Fixed-width data needs a reader that knows the column positions, such as pd.read_fwf in pandas, or the Text to Columns wizard in Excel with its “Fixed width” option, where you click to place the column breaks. If the spacing is irregular and you find yourself fighting it, check with whoever produced the file whether a real CSV export exists. It usually does, and it saves you an hour of guessing.

A quick checklist

  • Open the file in a text editor and read the first line.
  • Check the delimiter appears a consistent number of times on each line.
  • Decide whether decimal commas are involved before you convert anything.
  • Use an import dialog or a parser, not find and replace.
  • Check column count and a few numbers after the change.
  • Save the output as UTF-8 and keep the original file.

The short version

A delimiter is just the character that separates fields, and the mismatch between the writer’s choice and the reader’s guess causes nearly every “my CSV opens wrong” problem. Look at the file yourself, choose the delimiter on purpose, and convert with a parser rather than find and replace. Then a CSV is a CSV again.

Frequently asked questions

Why does my CSV file open in a single column in Excel?

Excel splits CSV files using the list separator from your computer's regional settings, and your file uses a different character. A semicolon file opened on a machine that expects commas lands in one column. Import it through Data, then From Text/CSV and choose the right delimiter, or use Text to Columns on the existing column.

Why do European CSV files use semicolons?

In many countries the comma is the decimal mark, so 12,50 means twelve and a half. A comma can't also separate fields without causing chaos, so software in those regions uses a semicolon as the list separator and Excel follows suit when it saves a file called CSV.

How can I tell which delimiter a CSV file uses?

Open the file in a plain text editor and look at the header row. The character that sits between the column names and appears the same number of times on every line is the delimiter. Tools such as Python's csv.Sniffer can guess too, but a quick visual check is more reliable.

Can I just find and replace semicolons with commas?

Not safely. Some fields may already contain commas or semicolons, and a simple replace changes them too, which corrupts the structure. Use a tool that actually parses the CSV, reads it with the old delimiter and writes it out with the new one, quoting fields where needed.

Which delimiter should I use when I create a CSV file?

Use a comma for general sharing and software imports. Use a semicolon if your recipients are mostly Excel users in regions with decimal commas. Use a tab when your text often contains commas and semicolons. Whatever you choose, keep it consistent and quote any field that contains the delimiter.