Excel Removes Leading Zeros

Keep ZIP codes, phone numbers and long IDs exactly as they are in the CSV.

The Short Answer

A CSV has no column types, so Excel guesses. If a value looks like a number, Excel stores it as a number. Numbers have no leading zeros, so ZIP code 02134 becomes 2134. Numbers longer than 15 digits lose their last digits.

Saving the column as text fixes it. The most reliable way is to turn the CSV into an .xlsx with those columns stored as text, because then it opens correctly on a double-click, for anyone.

Keep leading zeros in an .xlsx →

What Excel Does to Number-Like Text

Microsoft explains it in Keeping leading zeros and large numbers: Excel removes leading zeros and shows large numbers in scientific notation so that formulas and maths work on them. It also says Excel has "a maximum precision of 15 significant digits", so in a number with 16 or more digits, every digit after the 15th becomes a zero.

In the CSVAfter Excel opens it
02134 (ZIP code)2134
000123 (customer ID)123
123456789012345678 (18-digit ID)123456789012345000, shown in scientific notation

The last one is the dangerous one: the ID looks fine at a glance in scientific notation, but the real digits are gone. If you save the file, the changed values are written back.

Fix 1: Save an .xlsx With Text Columns

  1. Open the CSV Fixer and pick your CSV.
  2. Under Keep as text, check the ticked columns. Columns with leading zeros, a leading + or more than 15 digits are ticked for you; tick any others you want kept exactly.
  3. Check the preview, then click Download .xlsx.
  4. Double-click the .xlsx. The ticked columns are text cells, so 02134 and the full 18-digit ID are shown exactly as written.

We checked the output by reading it back with a separate spreadsheet library: the ZIP code and an 18-digit ID are stored as text cells with the Text number format, while ordinary numbers in other columns stay numbers.

Fix 2: Import the CSV as Text in Excel

Instead of double-clicking the CSV, import it, which lets you set each column's type. Microsoft's steps:

  1. Go to Data → From Text/CSV and pick the file.
  2. Click Transform Data (called Edit in some versions) to open Power Query.
  3. Select the column, then set Data Type to Text and choose Replace current.
  4. Click Close & Load.

In the same import window, the data type detection drop-down also has an option to not detect data types, which leaves every column as text (Microsoft's Text/CSV connector documentation).

Fix 3: Turn Off the Conversion (Newer Excel Only)

Excel for Microsoft 365 and Excel 2024, on Windows and Mac, have an Automatic Data Conversion setting:

Untick Removing leading zeros from numerical text and converting to a number and Truncating numerical data to 15 digits of precision. This only changes your own Excel; anyone you send the CSV to still gets the conversion. Microsoft lists the setting only for Microsoft 365 and Excel 2024, so older versions such as Excel 2016 and 2019 don't offer it.

Things That Trip People Up

Platform Notes

Excel for Windows has all three fixes. Excel for Mac has Data → Get Data → From Text/CSV in Microsoft 365 and Excel 2024, and the Automatic Data Conversion setting under Preferences. The .xlsx route works in any version of Excel that opens .xlsx files, because the cells are stored as text in the file itself.

Frequently Asked Questions

Why does Excel remove leading zeros from my CSV?

A CSV is plain text with no column types, so Excel guesses. Anything that looks like a number is stored as a number, and a number has no leading zeros, so 02134 becomes 2134. Microsoft says Excel does this so formulas and maths work on the values.

Why do long numbers end in 000 in Excel?

Excel stores numbers with 15 significant digits. Microsoft's support page says that for a number with 16 or more digits, such as a credit card number, any digits past the 15th are changed to zero. An 18-digit ID like 123456789012345678 becomes 123456789012345000, and is usually shown in scientific notation.

Can I turn this off in Excel?

In Excel for Microsoft 365 and Excel 2024 (Windows and Mac) there is an Automatic Data Conversion setting. On Windows it is under File, Options, Data; on a Mac under Excel, Preferences, Edit. You can untick removing leading zeros and truncating to 15 digits. Microsoft lists it only for those versions.

Does formatting the column as Text afterwards bring the zeros back?

No. By then the cell already holds the number 2134, so changing the format only changes how that number is shown. Set the column to Text while importing, or reopen the original CSV a different way.

What is the most reliable way to send a CSV that keeps leading zeros?

Send an .xlsx instead, with those columns stored as text. A CSV can't mark a column as text, so every person who double-clicks it gets the same conversion. In an .xlsx the text cells stay text whoever opens it.

Is my data uploaded if I use the CSV Fixer?

No. The CSV Fixer reads the file and builds the .xlsx with JavaScript in your browser. Nothing is sent to a server.