Remove the BOM from a UTF-8 CSV ( at the start)
Two typical symptoms. Either the first cell begins with
 (for example ID), or an import tool
claims the column ID doesn't exist even though it plainly
does. In both cases the culprit is an invisible three-byte marker at the
very start of the file.
what you see: id,name,email what is there: [EF BB BF] id,name,email
What a BOM is
BOM stands for byte order mark. In UTF-16 it tells the reader which byte
order to use. UTF-8 has no byte order problem, but some programs, Excel
above all, still write the bytes EF BB BF at the start to say
"this is UTF-8." Excel actually depends on that marker: without it, it
often reads a UTF-8 CSV as Windows-1252 and garbles accents.
The marker is harmless to software that expects it and a bug for software
that doesn't. A parser that doesn't strip it treats it as part of the first
header, so the column is named id rather than
id. Database imports, scripts that look up a field by name, and
some web APIs then fail. If the first header is quoted, a parser may also
stumble on the opening quote.
How to check
Open the file in a text editor that shows encodings. In VS Code the status
bar reads "UTF-8 with BOM" when one is present. Notepad++ shows it in the
Encoding menu. In a terminal, head -c 3 file.csv | xxd prints
efbbbf if there is a BOM.
How to remove it
- VS Code: click the encoding in the status bar, choose Save with Encoding, then UTF-8 (plain, no BOM).
- Notepad++: Encoding ▸ UTF-8 (the entry without "BOM"), then save.
- Windows Notepad: Save As, pick UTF-8 from the encoding list. In recent Windows 10 and 11 versions this means without a BOM; older Notepad versions call the BOM version "UTF-8", so check the result.
- Command line:
sed -i '1s/^\xEF\xBB\xBF//' file.csvon Linux or macOS with GNU sed.
One trade-off: once the BOM is gone, a double-click in Excel may show accented characters wrongly again. Keep the BOM on files meant for Excel users, and remove it for files meant for code, databases and uploads.
BOM or no BOM: which should you use?
It depends on who reads the file. Excel on Windows needs the BOM to read
UTF-8 reliably, so a file for Excel users should have one. Most programming
languages, databases, command-line tools and web services expect no BOM.
Python can read a BOM file with encoding='utf-8-sig', which
strips it, but you can't rely on every consumer to do that. If a file has to
work in both worlds, keep two copies, or document which one you send.
CSV Fixer detects a BOM when it reads your file and drops it, so the first column name comes out clean. The "Add a BOM" box is off by default, which means the file you download has no BOM unless you tick it. Turn it on only if the file is going to Excel. Preview, download, and nothing is uploaded; it all runs in your browser.
Fix my CSV