Left-pad Text
Pad the left side of every line to a fixed length. Runs entirely in your browser, so your data never leaves your device.
0 chars · 0 lines
Output
The result appears here as you type.
How to use Left-pad Text
- 1. Paste the lines you want padded. Enter one value per line, such as a column of numbers or short codes that need to line up to a consistent width.
- 2. Set Pad to length. Enter the total character width every line should reach. Shorter lines get padding added on the left until they match this length; longer lines are left unchanged.
- 3. Choose the Pad with character. Type the character to fill the gap with, using the first character you enter. A zero produces zero-padded numbers, while a space produces a right-aligned column.
- 4. Copy the padded output. Copy the aligned lines into a spreadsheet, fixed-width file, or wherever consistent-width values are required.
When to use Left-pad Text
Left-pad Text adds characters to the start of every line until it reaches a fixed width, which is exactly what number formatting, fixed-width file formats, and column alignment require. Instead of writing a padStart loop, paste the list and set the target width.
- Zero-padding invoice numbers. Invoice IDs need to always show as five digits, like 00042 instead of 42, to match an existing numbering convention. Padding with a zero to length 5 formats the whole batch at once.
- Aligning a column of prices in a plain-text report. A monospace report needs prices right-aligned within a fixed column width so decimal points line up visually. Padding with a space to the column width does it without a spreadsheet.
- Building fixed-width records for a legacy import. An old batch-processing system expects every field to be exactly 8 characters wide, padded with zeros on the left. Left-padding each value to that width prepares the file for import.
- Formatting time components with leading zeros. Minutes and seconds pulled from a calculation come out as single digits like 5 and need to display as 05. Padding to length 2 with a zero fixes every value in the list.
Examples
Zero-pad numbers to width 5
Input
7 42 1337
Output
00007 00042 01337
About the Left-pad Text tool
Left-pad Text runs as plain JavaScript in your browser tab, with no server behind it. Pad the left side of every line to a fixed length. Whatever you put in stays on your device from start to finish.
The tool is part of EditSafely's Text Tools section, 211 single-purpose utilities built around the same idea: open the page, get the result, keep your data to yourself.
You can shape the output with 2 settings, including Pad to length and Pad with (first character), and the result refreshes the moment you change one. A worked example further down the page shows exactly what the tool produces for a real input.
That local-first design has practical benefits beyond privacy. The tool keeps working on a flaky connection once the page has loaded, results are instant because nothing round-trips to a server, and it is safe to use with confidential material.
Frequently asked questions
Does Left-pad Text cost anything?
Yes, it is completely free. All 2,658 tools on EditSafely work without an account, a subscription or usage limits.
Is it safe to paste sensitive or confidential data?
No data leaves your device. The whole tool is JavaScript that runs inside your browser tab, so there is no upload, no server-side processing and no log of what you did. If you disconnect from the internet after the page loads, it keeps working.
How much text can I process at once?
There is no fixed limit. Because the work happens on your own device rather than on a shared server, the practical ceiling is your machine's memory, which comfortably handles inputs far larger than typical online tools allow.
Do I need to sign up or install anything?
Nothing to install and no account needed. Open the page in any up-to-date browser, including on a phone or tablet, and the tool is ready.
How do I use the result?
The output panel has a one-click copy button, and you can keep refining the input while you work; the result updates in place as you type.