How to Insert 0 in Excel: Keep Leading Zeros
In this article
To type a plain zero-as-text in a cell, put an apostrophe before the number: type '0 and press Enter. Excel stores it as text and displays the zero. If you need a zero at the start of a longer number (like a zip code such as 01234), the apostrophe trick still works, but the better long-term fix is to format the cells as Text (Home > Number > Text) before you type, or apply a custom number format that forces leading zeros. The method you pick depends on whether you want a literal zero character in the cell or a number that simply looks like it has a leading zero.
What You'll Need
- Microsoft Excel on Windows, Mac, the web, or the mobile app — the steps below are for the desktop app and note where mobile differs
- A sheet with at least one empty cell
- A decision on whether you want text or a formatted number (explained below), because the two behave differently in formulas and sorting
Step-by-Step
- Know what you actually need. There are two different jobs hidden under "insert 0 in Excel": keeping a literal zero in the cell (so it stays visible and is treated as text), and making a real number display with a leading zero (like 007 or 01234). Pick one before you start. The menu labels below can differ slightly by version, device, or region.
- Type a zero as text with an apostrophe. Click the cell, type an apostrophe then the zero (for example
'0), and press Enter. The apostrophe does not appear in the cell but tells Excel the entry is text. This is the fastest one-off fix and works the same on every platform. - Or format a whole range as Text first. Select the cells, then go to Home > Number, open the format dropdown (the list that usually says General), and choose Text. Everything you type in those cells afterward, including a leading zero, stays exactly as typed. Do this before entering data — cells already holding numbers are not converted retroactively.
- Or use a custom number format for numeric-looking leading zeros. Select the cells, press Ctrl+1 (Cmd+1 on Mac) to open Format Cells, go to the Number tab, choose Custom, and type a pattern of zeros such as
00000in the Type box. A five-zero format makes the number 123 display as 00123. The cell remains a real number, which is usually what you want if the values need to sort, sum, or be used in formulas. - Watch the decimal-place branch. If what you want is a zero after the decimal point (0.50 instead of 0.5), use Format Cells > Number with two decimal places, or click the Increase Decimal button on the Home ribbon. That is a display setting, not an inserted zero character.
- Fix a column that lost its leading zeros all at once. Select the existing values, switch the format to Text, and re-type only the affected entries. Formatting never restores digits Excel already discarded when it read 01234 as 1234. For a large import, format the destination column as Text before pasting, or use Data > Get Data > From Text/CSV and set that column's type to Text during import.
- Check the result with a formula. If you used a custom number format, confirm the cell still calculates normally by pointing a SUM formula at it. If you used text, confirm a formula like
=A1*1still returns a number — text entries are ignored by some calculations, which is the trade-off you accepted. - Align the cell if it looks off. Text zeros sit on the left of the cell and numbers on the right, by default. If the alignment matters, set it deliberately with Home > Alignment instead of adding spaces.
Common Mistakes
- Typing a zero into a General-formatted cell. A cell holding just 0 is fine, but leading zeros in longer entries are stripped the moment you press Enter. Excel sees a number, not a code.
- Formatting after the damage is done. Switching to Text or a custom format does not put back zeros that were already removed. Always format before typing or importing.
- Using text where a number is needed. Text entries are skipped by SUM, AVERAGE, and most lookup tricks that expect numbers. If the column feeds calculations, prefer a custom number format.
- Expecting the apostrophe to display. It is a prefix, not content. If you actually want to show an apostrophe, type two of them or format the cell as Text and type the apostrophe directly.
- Pasting over a Text column. Normal paste can re-convert text that looks numeric. Use Paste Special > Values, or keep the source as text.
- Confusing the decimal increase buttons with leading zeros. Increase Decimal adds places after the point; it will not add a zero in front of a number.
Tips
- Set the Text format on an entire column before importing phone numbers, zip codes, product codes, or student IDs. It saves more time than any repair afterward.
- Custom formats can include separators, for example
000-00-0000for a nine-digit code, which gives you formatted zeros without changing the stored number. - The mobile Excel app exposes the same Text and Custom options through its format menu, though the layout is condensed compared with the desktop ribbon. Look for the number format icon near the formula bar area.
- If you only need one cell, the apostrophe method is faster than opening Format Cells. Reach for custom formats when the column is long or repeats every month.
- Keep the zeros entered on purpose: use a leading zero format only on rows that need it, and leave a General-formatted number column elsewhere so calculations stay simple.
Troubleshooting
The zero disappears as soon as you press Enter. Excel is treating the cell as a number. Put an apostrophe in front of the number, or change the cell to Text format and re-enter it. Note that if the digit was already dropped, retyping is required.
The apostrophe shows up in the cell. You probably have the cell set to Text and typed a single quote. Type two apostrophes, or drop the apostrophe entirely and rely on the Text format.
Formulas stop counting the column. You converted real numbers to text. Change those cells back to General or Number and apply a custom format such as 00000 so the zero shows while the value stays numeric.
A pasted list loses zeros again. The destination was General when you pasted. Format it as Text first, then paste as Values, or import via Data > Get Data > From Text/CSV with the column typed as Text.
The custom format does nothing. Check that you typed the zero pattern in the Type box on the Custom category, not in the Number category's decimal places. Also confirm the format was applied to the selected cells and not just the active one.
Everything still misbehaves. Save your work, close and reopen the workbook, then test with a single empty cell in a new sheet to rule out any leftover formatting in the original. If you changed the file from another program, confirm it was saved as .xlsx rather than .csv, since CSV files lose formatting and leading zeros on reopen.
Frequently Asked Questions
Why does Excel remove the zero when I type 01234?
Because General format treats it as a number, and numbers do not have leading zeros. Use an apostrophe, set the cells to Text, or apply a custom format with enough zeros.
What is the quickest way to add a zero in front of a number?
For a single cell, type an apostrophe before the number. For a whole column, select it, open Format Cells with Ctrl+1, choose Custom, and type a zero pattern like 00000.
Does the apostrophe method work on the Excel mobile app?
Yes. The apostrophe prefix is handled by Excel itself, not the keyboard, so it works on Windows, Mac, the web, iPhone, and Android.
Can I add a leading zero without changing the cell to text?
Yes, through Format Cells > Number > Custom and a zero pattern. The cell stays a real number, so it still sorts and sums correctly.
Will a custom format restore zeros I already lost?
No. If the digits were dropped on entry, the original zero is gone. Retype the values after applying the Text or Custom format.
Why do zeros vanish when I export to CSV?
CSV has no formatting layer, so custom formats are lost. Open the file in Excel with Data > Get Data > From Text/CSV and set the affected column's type to Text before loading.