Add leading zeros
Type a number or a list (one per line). Set the width. Each value is padded on the left with zeros.
How to use the Add leading zeros
What does the Add leading zeros do?
Pad numbers with leading zeros to a fixed width; It applies this page-specific rule: padding is string work, not math.
Which inputs does this tool use?
To pad numbers with leading zeros to a fixed width, enter Values (one per line), Width; keep every value in the same example; the page then updates the result from the current values; Start with a familiar case covered by this rule - One value per line so you can paste a column from a spreadsheet - so the expected result can confirm the settings.
How should the tool result be read?
For a result intended to pad numbers with leading zeros to a fixed width, one value per line so you can paste a column from a spreadsheet; read width together with the original values (one per line) rather than as an isolated answer, and confirm that its units or structure match the intended use.
Does 007 stay a number?
When the goal is to pad numbers with leading zeros to a fixed width, in this box it is text.
Negative numbers?
When using the page to pad numbers with leading zeros to a fixed width, the minus stays in front: −7 at width 3 → −007.
Limits and accuracy
When using this tool to pad numbers with leading zeros to a fixed width, this will not change how Excel displays a cell; check the result in its intended destination before relying on it for important work; keep values (one per line) until the output has been checked in its intended destination. For a repeatable check when you need to pad numbers with leading zeros to a fixed width, record Values (one per line) alongside the final output and selected options. A known example using values (one per line) can confirm how the page will pad numbers with leading zeros to a fixed width.
How this works
Padding is string work, not math. 7 at width 3 is “007”. Values already longer than the width are left alone. Non-digit prefixes such as “IMG_” stay put; only the trailing digits are padded if you use that mode.
One value per line so you can paste a column from a spreadsheet. Spaces around a line are trimmed.
This will not change how Excel displays a cell. Copy the padded text back as text, or the spreadsheet will drop the zeros again.
Frequently asked questions
Does 007 stay a number?
In this box it is text. Most spreadsheets will strip zeros if you paste into a numeric cell.
Negative numbers?
The minus stays in front: −7 at width 3 → −007.
Max width?
32.