Add Leading Zeros
Pad numbers on the left with zeros so that 7 becomes 007 or 00007. Ideal for IDs, invoice numbers, codes and file names that must sort correctly.
Pad every line of text to a fixed length with zeros, spaces or any character. Left, right or center. Free and no signup.
Add your text, one item per line, or try a sample list.
Pick the side, the target length and the padding character.
Copy the padded lines or save them as a text file.
Need to add leading zeros to a list of numbers or make every line the same length? This free text padding generator pads each line of your text to a fixed length with zeros, spaces or any character you choose. Paste your list, pick the padding side (left, right or both), set the target length and choose the padding character. A number such as 7 can become 0007, a word can be filled with dots up to a set width, and a column of text can be centered with spaces. You can also pick Longest line as the target, so every line is padded to match the longest one without choosing a number. No signup and no installation are needed.
Padding is useful in many everyday and technical tasks. You may need fixed width IDs such as 00125, invoice or order numbers with the same number of digits, aligned columns in plain text, table of contents lines with dot leaders, or data in a fixed width file format. Doing this by hand is slow, and spreadsheet formulas are not always at hand. This online padding tool pads thousands of lines instantly. It can trim lines first, cut lines that are longer than the target and skip empty lines, and everything runs in your browser, so your text is never uploaded or stored.
Pad numbers on the left with zeros so that 7 becomes 007 or 00007. Ideal for IDs, invoice numbers, codes and file names that must sort correctly.
Add characters before the text, after the text or on both sides. Right align numbers, left align labels or center titles.
Pad every line to a fixed number of characters, or to the length of the longest line, with any character or pattern.
Padding means adding extra characters to a piece of text until it reaches a certain length. A text padding generator does this for every line of your text at the same time. The extra characters are called the padding character, and they can be zeros, spaces, dashes, dots, stars or any character or pattern you type.
People search for it as add leading zeros online, pad numbers with zeros, left pad string, right pad text, zero pad numbers, or make all lines the same length. This tool covers all of them without any code or formulas.
Padding takes a few seconds with our free tool.
To add line numbers instead of padding, try the Text Line Numbering, and to check how long your lines are, use the Word Counter.
| Side | What happens | Example with length 6 and character 0 or a dot |
|---|---|---|
| Left | Characters are added before the text, so lines end up right aligned | 42 becomes 000042 |
| Right | Characters are added after the text, so lines end up left aligned | Total becomes Total. |
| Both | Characters are added on both sides, so the text is centered | Menu becomes .Menu. style spacing |
Left padding is the best choice for numbers and codes, because digits line up in columns. Right padding is useful for labels, and both sides are good for headings and centered text in plain text layouts.
| Goal | Settings | Result |
|---|---|---|
| Add leading zeros to IDs | Left, length 5, character 0 | 7 becomes 00007 |
| Make invoice numbers 8 digits | Left, length 8, character 0 | 1205 becomes 00001205 |
| Align names in a text table | Right, longest line, space | Names fill the same width |
| Create dot leaders | Right, fixed length, character dot | Chapter 1 followed by dots up to a set width |
| Center a title | Both, fixed length, space | Equal space on both sides |
| Fixed width data files | Right, fixed length, space | Every field takes the same number of characters |
Use Fixed when a system requires an exact length, such as an ID with exactly 8 digits. Use Longest line when you only want all lines to match each other, for example to align a plain text table. The tool finds the longest line for you, so you do not have to count characters.
A line that is already longer than the target length cannot be padded. By default it stays as it is. If you need every line to be exactly the same length, turn on Cut longer lines, which shortens long lines to the target length. Be careful, because cutting removes real characters, so check the result before you use it. The options Trim lines first and Skip empty lines help you control the spaces and blank rows in your list.
Spreadsheet programs treat values such as 00125 as numbers and remove the zeros in front. To keep them, set the column format to Text before you paste, or import the data as text. Another way is to add an apostrophe at the start of the value in Excel, or to use a custom number format such as 00000. Zeros that are part of text, such as in a CSV file opened as text, stay in place.
Yes. Your text never leaves your device. Padding happens inside your browser and nothing is saved or stored. As a general habit with any online tool, avoid pasting passwords or highly sensitive information unless you are comfortable with how it is handled.
This tool is often one step in a bigger text workflow. These related free tools help with the rest of the job:
Our text padding generator was built to make fixed length text simple. You can add leading zeros, pad on either side or both, and use any character, with no signup, no formulas and no uploads.
Ready to try it? Scroll back up, paste your list and pad it in a second.
Quick answers about adding leading zeros, left, right and center padding, padding characters and keeping zeros in Excel.
Paste your numbers with one on each line, set the padding side to Left, choose 0 as the padding character and enter the total length you want, for example 5. Click Pad text and every number is filled with zeros up to that length, so 42 becomes 00042. Then copy the result or download it as a text file. It is free and needs no signup.
Left padding adds characters before your text, which right-aligns it and is ideal for numbers. Right padding adds characters after your text, which left-aligns it and suits names and labels. Both sides pads on the left and right to center the text. In center mode, any extra odd character goes on the right side.
Yes. Click a preset such as 0, space, dash, underscore, dot or star, or type any character or short pattern into the padding character box. A single character fills the space exactly, while a longer pattern is repeated and cut to fit the target length.
By default they are left unchanged, so no text is lost. If you want every line to be exactly the same length, turn on the Cut longer lines option and the tool shortens any line that goes over the target. Use that option carefully, since the removed characters cannot be restored from the result.
Yes. Switch the target length to Longest line and the tool measures your longest line and pads every other line to match it. This is useful for tidy blocks of text and aligned columns when you do not have a specific length requirement.
Spreadsheet apps treat values like 00042 as numbers and often drop the zeros automatically. To keep them, format the column as Text before you paste, or add an apostrophe in front of the value. The padded text from this tool is correct, the change happens only when the spreadsheet converts it back into a number.
The padding happens inside your browser, so your text is not uploaded to our servers and is not saved or stored. You do not need an account to use it. As a general habit with any online tool, it is still wise to avoid pasting highly sensitive information unless you are comfortable with how your device and browser handle it.
Pad text to a fixed length, then number lines, sort lines or clean text in seconds. Explore free text tools to write, edit and format all your content in one place.
Explore All Text Tools →