Zero Padding & Text Padder
About this tool
Pad every line of a list to a fixed length with zeros or any other character. It is the quick way to restore leading zeros that a spreadsheet dropped from ZIP codes, product codes, employee IDs or invoice numbers, and to make IDs sort and compare correctly as text.
Everything runs in your browser. Your data is never sent to a server.
How it works
- Pad on the left adds the padding character in front until the line is the target length (
42becomes00042); Pad on the right adds it at the end. A line that is already as long as the target, or longer, is left unchanged and never cut. - Remove leading padding characters does the opposite of left padding: it strips the padding character from the start of each line, keeping at least one character (
0007becomes7, and000becomes0). The target length is not used. - Lines made only of digits (0 to 9) are padded and everything else, including empty lines, is passed through untouched. Every line pads all lines, and an empty line becomes a line of padding characters.
- Length is counted in characters (Unicode code points), so an emoji counts as one. Some emoji and accented letters are built from several code points, which can make a line look shorter or longer than its count.
- The padding character can be one character only. If you type more, the first one is used.
- Negative numbers (
-5), decimals (3.14) and numbers with a plus sign or thousands separators are not made only of digits, so choose Every line if you want them padded as text.
FAQ
Q. Why did Excel remove my leading zeros?
A. A cell formatted as a number stores 00123 as the number 123. Format the column as Text before pasting, or keep the zeros in a text column. This tool gives you the padded text to paste into a Text-formatted column.
Q. Can I pad with spaces or other characters?
A. Yes. Type a space, a dash, an X or any other single character in the padding character box and choose Every line if the values are not only digits.
Q. Will 007 and 7 become the same?
A. With left padding to the same length, yes: both become the same padded value. Use Remove leading padding characters to compare them the other way.