FormulaCraft

How to add leading zeros to a number in Excel and Google Sheets

Topic:Text manipulation
Excel & Google Sheets
=TEXT(A2,"00000")

Verified example

Computed by a real spreadsheet engine on the sample data below.

Number
123
4567
89

=TEXT(A2,"00000")00123

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Enter your numbers in a column, e.g., A2:A4.
  2. 2In an adjacent cell, use the TEXT function to format the number with leading zeros.
  3. 3Adjust the number of zeros in the format string to match your desired length.

Tips

Working on a sheet you inherited? Run the Auditor on the whole file first — it flags every #REF!, #N/A, broken column pattern, and inconsistent formula in seconds, free, no signup.

Frequently asked

Can I use this method for phone numbers?

Yes, but remember the result will be text, so avoid using it in calculations.

What if my numbers have different lengths?

Set the format string to the maximum length you need, and all numbers will be padded with leading zeros accordingly.

Is there a limit to the number of zeros I can add?

No practical limit, but excessively long strings may affect readability and performance.

More on Text manipulation

See all →

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: