CSVLane

Runs in this tab. Nothing is uploaded. Check it yourself

Encoding · Byte comparison

CSV vs CSV UTF-8

By CSVLane · Published 30 October 2026

A CSV UTF-8 file is an ordinary CSV whose text is encoded as UTF-8, and it usually starts with a three-byte mark (EF BB BF). Choose it when your data has accents or non-Latin letters. The commas and rows are identical; only the bytes for characters outside plain English differ. The mark matters mostly for Excel: Microsoft says a UTF-8 CSV opens normally if it was saved with the mark.

The same three rows, four encodings

These four files contain the same text: Zoë Müller, José Peña, Chloé Dubois. Sizes and bytes below are read from the files themselves.

FileEncodingSizeFirst bytesë is stored as
cafe-utf8-bom.csvUTF-8 with BOM88 bytesEF BB BF 69 64 2CC3 AB
cafe-utf8.csvUTF-8, no BOM85 bytes69 64 2C 6E 61 6DC3 AB
cafe-windows-1252.csvWindows-125277 bytes69 64 2C 6E 61 6DEB
cafe-utf16.csvUTF-16 LE with BOM156 bytesFF FE 69 00 64 00EB 00

Three bytes separate the first two rows of that table: that is the byte order mark, or BOM. The Unicode FAQ describes it for UTF-8 as a signature that identifies the encoding. It has no effect on how the text is read. The Windows-1252 file is smaller because each accented letter takes one byte instead of two, but that encoding only covers Western European letters: asking Python to save 東京 as Windows-1252 raises an error, and with errors="replace" the two characters become ??.

What the wrong guess looks like

A CSV file does not say which encoding it uses. RFC 4180 leaves the character set to a MIME parameter, which a file on disk does not have. So software guesses, and a wrong guess produces one of two recognisable patterns:

You seeWhat happenedFix
Zoë MüllerUTF-8 bytes read as Windows-1252Re-open as UTF-8
Zo� M�llerWindows-1252 bytes read as UTF-8Re-open as Windows-1252
CSVLane showing a UTF-8 file forced to Windows-1252: names display as Zoë Müller
cafe-utf8.csv forced to Windows-1252 under Separator & encoding: two bytes per accented letter, shown as two wrong characters. Open this example in CSVLane ↗
CSVLane showing a Windows-1252 file forced to UTF-8: accented letters display as replacement characters
cafe-windows-1252.csv forced to UTF-8: the single bytes are not valid UTF-8, so each becomes a replacement character. Open this example in CSVLane ↗

The first pattern can be undone by re-reading the original with the right encoding. If a program has saved the file with replacement characters, the letters are gone from that copy, so go back to the source. On auto-detect, CSVLane read all four test files correctly, using the BOM if there was one, then strict UTF-8, then Windows-1252 with a notice.

The BOM cuts both ways

The mark helps Excel and hurts some scripts. Here are the Python results on these files (3.9.6, csv.DictReader):

FileOpened asFirst column nameResult
UTF-8 with BOMutf-8\ufeffidA lookup of row["id"] fails; the name has an invisible character
UTF-8 with BOMutf-8-sigidCorrect
UTF-8, no BOMutf-8-sigidCorrect, so this setting is safe for both
Windows-1252utf-8—UnicodeDecodeError at the first ë
UTF-16 LEutf-8—UnicodeDecodeError at byte 0

The Unicode FAQ makes the same point in general terms: a BOM should be avoided with protocols that expect ASCII at the start.

Which one to choose

Where the file is goingUseReason
Opened by people in ExcelUTF-8 with BOMMicrosoft says this is the form that opens normally
Code, a database or an APIUTF-8, no BOM, unless its documentation says otherwiseNo hidden character in the first column name
A legacy system that asks for “ANSI”Windows-1252, if all your characters fitCheck for lost characters afterwards
UnsureUTF-8 with BOM, then test one fileHolds any character

Microsoft’s format table describes CSV (Comma delimited), CSV (Macintosh) and CSV (MS-DOS) by target system and names no encoding, so check a saved file rather than trust the name. Load it in CSVLane and read the encoding in the status line. CSVLane’s own CSV downloads are UTF-8 with a BOM; its JSON output has no BOM.

If a UTF-8 CSV without the mark looks wrong in Excel, Microsoft’s fix is to import it through Data > Get Data > From Text/CSV rather than open it. More on that in how to open a CSV file.

Where to go next

Sources

  1. Microsoft Support: Opening CSV UTF-8 files correctly in Excel, read 30 October 2026.
  2. Microsoft Support: File formats that are supported in Excel, read 30 October 2026.
  3. Unicode FAQ: UTF-8, UTF-16, UTF-32 & BOM, read 30 October 2026.
  4. RFC 4180: Common Format and MIME Type for CSV Files, read 30 October 2026.
  5. Python documentation: csv module, read 30 October 2026.