Excel Changes Long Numbers and Drops Leading Zeros in CSV: How to Fix It

Published 23 November 2026 · 6 min read

You open a CSV in Excel and the order ID 12345678901234567890 now reads 12345678901234600000. A zip code that was 02134 is now 2134. A product code turned into a date. Nothing is wrong with your file. Excel changed the data while opening it, and if you save, the change becomes permanent.

This guide explains why it happens and gives you four ways to stop it, from a quick fix to a permanent one.

Why Excel does this

A CSV file is plain text. It cannot say that a column holds text rather than numbers, so Excel guesses from what it sees. Microsoft documents the guesses that cause the damage:

  • Leading zeros are removed. 00123 becomes the number 123.
  • Numbers are cut to 15 digits. Excel has a maximum precision of 15 significant digits, so in a number with 16 or more digits, everything after the 15th digit becomes zero.
  • Long numbers turn into scientific notation, such as 1.23E+15, so that formulas can work on them.
  • Letters mixed with numbers can become dates. A value such as MAR1 or 1-2 may be read as a date.

The 15-digit limit is the one that hurts most, because the digits are gone, not just hidden. Credit card numbers, order and tracking IDs, social media post IDs and many database keys are longer than 15 digits. Rounding them to zeros produces a different ID that may still look plausible.

What gets changed

In the CSVWhat Excel showsWhy
021342134Leading zero treated as meaningless
12345678901234561234567890123450Only 15 digits are kept
1234567890121.23457E+11Display shortened to scientific notation, often with the full value still stored
1E5 in a product code100000Read as scientific notation
MAR1A dateLetters and digits read as a date

Fix 1: import the file instead of double-clicking it

Double-clicking a CSV applies Excel's guesses straight away. Importing lets you choose, and it is the method Microsoft recommends for keeping leading zeros and large numbers.

  1. Open a blank workbook in Excel.
  2. On the Data tab, choose From Text/CSV and select your file.
  3. In the preview, set Data Type Detection to Do not detect data types, or choose Transform Data and set each problem column to Text.
  4. Load the data. The values now stay exactly as they were in the file.

Columns formatted as text can no longer be used in calculations until you convert them back, which is usually fine for IDs, zip codes and phone numbers.

Fix 2: turn off the automatic conversions

Recent versions of Excel for Windows and Mac have a setting for Automatic Data Conversion in the Data options. You can switch off the conversion that removes leading zeros and the one that turns letters and numbers into dates. It applies when you open a CSV or text file, type data, or paste it. Microsoft notes that this does not fix the 15-digit limit for real numbers.

Fix 3: a custom format for zip codes and short codes

If the value has fewer than 16 digits and the workbook stays in Excel, you can apply a custom number format such as 00000 to show leading zeros. It only affects numbers entered after the format is applied and does not restore zeros that were already lost, so use it before pasting data, not after.

Fix 4: skip the CSV and send an Excel file

The cleanest fix is to stop sending Excel a format that cannot carry types. An .xlsx file stores each cell's type, so a long ID can be saved as text and open exactly as written, with no import steps for the person who receives it.

If your data is JSON, the JSON to Excel converter writes IDs and zip codes as text cells. If your data starts as CSV, you can convert it to JSON without touching the values, because that converter does not turn numbers into floats. If you do need to send a CSV from the JSON to CSV converter, the values are written as they are in your JSON, but the person who opens it still has to import it with Data, From Text/CSV, because a CSV cannot hold a column type.

Seeing garbled accents or a single column instead? That is a different problem, covered in CSV shows garbled characters or one column in Excel.

If you already saved over the file

Excel cannot restore digits it discarded, and a CSV carries no formatting that could bring them back. Go back to the original source, such as the export, the database or the API response, and import it again with one of the methods above. Do not save the damaged copy over the original.

Quick checklist

  • Any ID, card number or tracking code longer than 15 digits: treat it as text, always.
  • Zip codes, phone numbers and part numbers with leading zeros: text, or a custom format.
  • Never double-click a CSV that contains these columns. Use Data, From Text/CSV.
  • Prefer .xlsx when the file is going to someone else.

Sources: Microsoft Support, Keeping leading zeros and large numbers and Set automatic data conversions.