
How to Keep Leading Zeros in Excel — Complete Fix for Phone Numbers, ZIP Codes, and Long Numbers
When leading zeros disappear in Excel, set the column to text or use a custom number format to control how values appear. For CSV or web data, set the column type to Text during import.
Quick Fix (3 Minutes)
- Set the column format to Text before pasting.
- For values that have already changed, use custom zero padding or Text to Columns – Finish.
- For scientific notation, convert to text and then re-evaluate the values.
How It Works
Excel interprets values as numbers by default, so leading zeros are removed. Values longer than 15 digits may be rounded, with some digits changed to zeros, so it is safest to store them as text.
Solutions by Situation
Text and Custom Number Formats
- ZIP code: custom format
00000 - Phone number:
000-0000-0000 - Long numbers: store as Text
Prevent Scientific Notation
Set the column to Text → use Text to Columns – Finish to re-evaluate the values. Values longer than 15 digits must be stored as text.
Preserve Values from CSV or Web Data from the Start
Go to Data > From Text/CSV → set the relevant column to Text → load it.
Display vs. Storage
Use numbers for calculations and text for identifiers. Control report appearance with custom number formats.
Practical Example
// Display with 8-digit zero padding
Custom format: 00000000
// Create as text
=TEXT(A2,"00000000")
Troubleshooting
| Symptom | Cause | Solution |
|---|---|---|
| 00123→123 | Interpreted as a number | Text format or custom format 00000 |
| 1.23E+11 | Scientific notation | Set to Text, then re-evaluate |
| Zeros at the end of a 16-digit value | Rounding beyond 15 digits | Store as text from the start |
| Zeros lost in a CSV file | Automatic type detection | Set the column to Text in the Text/CSV import |
Related Articles
- Fix “Number Stored as Text”
- Fix CSV Encoding Issues
- TEXTSPLIT Preprocessing
- Get Started with PivotTables in 10 Minutes
- Create a Drop-Down List