Why Excel removes leading zeros from a CSV (and how to stop it)
Zip codes, account numbers, and product codes losing their leading zeros when a CSV is opened in Excel — why it happens and how to prevent or fix it.
Before you work through this by hand: you can check your own CSV free and see which of these problems your file actually has — duplicate rows, near-duplicates, broken quoting, encoding damage. It runs in your browser tab, nothing is uploaded, and there's no signup or email.
Why this happens
Excel guesses the data type of each column when it opens a CSV. If a column looks numeric (like a ZIP code "00501" or an account number "0042"), Excel converts it to a number and drops the leading zeros — showing "501" or "42" instead. This happens purely because CSV files don't store column types; Excel is guessing, and it guesses "number" by default.
Preventing it on import
Instead of double-clicking the CSV to open it, use Excel's Data → From Text/CSV (or the older Text Import Wizard) and explicitly set the affected column's format to "Text" during import. This tells Excel not to reinterpret the values as numbers.
Fixing it after the fact (if you already lost the zeros)
If you already opened and re-saved the file and the zeros are gone, you generally can't recover them automatically — Excel doesn't know how many there were supposed to be. This is why it's worth keeping the original CSV export as a backup and only working from copies.
If you're generating the CSV yourself
You can force a text interpretation for downstream tools by prefixing the value with an apostrophe (e.g. '00501) in some editors, though this isn't part of the CSV standard and doesn't help if a colleague opens the raw file directly in Excel — the import-as-text method above is more reliable for a file other people will open themselves.
Keeping this in mind while cleaning data
If you're deduping or editing a CSV that has ID/zip-code columns, check whether any tool you use in the process (including a spreadsheet preview) has silently reformatted those columns before you export the final file.
See also: our CSV cleanup checklist and duplicate-removal guide for other pre-import checks.
See CSV Repair & Deduper (offline browser tool) — $19 one-time