How to Paste Leading Zeros in Excel
In this article
To paste leading zeros in Excel and keep them visible, don't paste directly into a general-formatted cell. Instead, format the destination cells as Text before pasting, or paste into the formula bar, or use a custom number format. The quickest reliable method is to select the destination column, set its format to Text, then paste. This stops Excel from treating values like 007 as the number 7 and stripping the zeros.
What You'll Need
- Excel for Windows, Mac, or the web (steps are similar; menu labels can differ slightly by version and platform).
- Your source data containing the leading zeros, in a file or on the clipboard.
- Basic familiarity with selecting cells and opening the Format Cells dialog.
Step-by-Step
- Select the destination cells or column. Click the column header (for example, column A) or drag over the exact range where the data will go. If you paste into a single cell, Excel may expand the paste into adjacent cells, so selecting the full target area first gives you control.
- Open Format Cells. Right-click the selection and choose Format Cells, or press Ctrl+1 (Windows) or Command+1 (Mac). The Format Cells dialog opens.
- Choose the Text category. On the Number tab, select Text from the Category list, then click OK. The cells are now formatted as text, so anything you paste into them is stored exactly as typed, including leading zeros.
- Paste the data. Use Ctrl+V (Windows) or Command+V (Mac). If the source is a web page or another program, use Paste Special: right-click the destination, choose Paste Special, and select Text or Unicode Text to avoid bringing in unwanted formatting.
- Check a few cells. Click a cell and look at the formula bar. If it shows
007rather than7, the zeros are preserved. If the formula bar shows7, the cell was not formatted as Text before pasting, or the paste operation converted it. - If you already pasted and lost the zeros, fix it without retyping. Select the affected cells, open Format Cells (Ctrl+1), choose Custom, and enter a format code that matches the width you need, such as
00000for five digits. This displays leading zeros even though the underlying value is a number. Note that this changes display only; the stored value remains numeric. - For a whole column of ZIP codes or IDs, use Text format before importing. If you are bringing data in via Data > From Text/CSV, set the column's data type to Text in the import preview rather than General. This prevents Excel from stripping zeros during import.
Common Mistakes
- Formatting after pasting. Changing a cell to Text after the number has already been converted to
7does not bring the zeros back. Format first, then paste. - Using General format. General format treats entries as numbers and drops leading zeros. Always set Text or a custom format before pasting.
- Pasting into a cell that already contains a number. If the destination cell is not Text, Excel may reinterpret the pasted value. Clear the cell or format it first.
- Confusing display with storage. A custom format like
00000shows zeros but the cell still contains a number. If you need the zeros to be part of the actual value (for example, for a lookup or export), use Text format and paste as text. - Dragging to fill. If the source cell is Text and you drag the fill handle, Excel may copy the value correctly, but if the source is numeric with a custom format, dragging can carry the format rather than the zeros. Verify a filled cell in the formula bar.
Tips
- Use Paste Special > Values when you want to paste only the displayed text without formulas or formatting.
- For a quick one-off, type an apostrophe before the number (for example,
'007). Excel treats the entry as text and hides the apostrophe. This works for typed entries, not for pasted blocks. - When importing CSV files, set the column type to Text in the import wizard. This is more reliable than fixing zeros afterward.
- If you need leading zeros for identifiers like employee IDs or product codes, consider storing them as text from the start to avoid conversion issues in formulas and exports.
- Use
00000as a custom format for a fixed width. Adjust the number of zeros to match your longest ID.
Troubleshooting
If the zeros still disappear after pasting, check the cell format again: select the cell, press Ctrl+1, and confirm the category is Text, not General or Number. If the formula bar shows the number without zeros, the paste converted the value; undo (Ctrl+Z), reformat the destination as Text, and paste again. If you are pasting from a web page, the clipboard may carry HTML that overrides formatting; use Paste Special and choose Unformatted Text. If the data comes from another workbook, ensure the source cells are also text or that you copy the displayed value, not the underlying number. For CSV imports, re-import with the column set to Text. If a custom format shows zeros but formulas treat the value as a number, that is expected; use Text format if the zeros must be part of the value.
Frequently Asked Questions
Why does Excel remove leading zeros when I paste?
Excel treats entries as numbers by default, and leading zeros have no numeric value, so they are dropped. Formatting the destination as Text before pasting prevents this.
Can I keep leading zeros without changing the cell format?
You can type an apostrophe before the number, but for pasted blocks, formatting as Text or using a custom format is more practical.
Does formatting as Text affect calculations?
Yes. Text-formatted numbers are not used in arithmetic. If you need both leading zeros and calculations, keep a numeric column for math and a text column for display.
How do I paste ZIP codes with leading zeros?
Format the destination column as Text, then paste. Alternatively, import the data with the column type set to Text.
Why do my zeros show in the cell but not in the formula bar?
That means a custom number format is displaying zeros while the stored value is numeric. If the zeros must be part of the value, use Text format.
Can I fix zeros after pasting without retyping?
If the value was converted to a number, you cannot restore the original zeros by formatting alone. Undo the paste, format as Text, and paste again. For display-only zeros, apply a custom format like 00000.