Pad text on the left

Left pad inserts a fill character on the left of each line until the line reaches a target Width. It is the JavaScript String.prototype.padStart behaviour: lines shorter than the width grow to the width, lines already at or beyond the width pass through. The default fill is a space and the default width is 8 characters. To pad on the right side instead, see pad right.

Input
Line 1:1 LF cloud_done Saved locally
Result Pad Left
0 lines 0 chars

Right-aligned padding via padStart

Width is the target column count. Lines shorter than Width are prefixed with the Char fill until they reach the target. Lines already at or beyond Width are returned unchanged. Char defaults to a single space; if you supply a multi-character string only the first character is used (this matches padStart's repeat behaviour).

Per Line is on by default and applies the pad to every line independently. Turn it off to pad the whole input as one continuous string, useful for right-aligning a single-line field. Width is bounded by the registry to 1 through 200.

Common uses: zero-padding numeric IDs (Width 6, Char 0) for sortable filenames, right-aligning numbers in a column, indenting log entries to a fixed timestamp slot. To remove the padding later run trim whitespace or a regex strip via regex replace.

How to use pad text on the left

  1. 1Paste your lines into the input panel on the left.
  2. 2Set Width to the number of characters each line should reach.
  3. 3Type the fill character into Char. Only the first character is used.
  4. 4Leave Per Line on (the default) to pad each line; turn it off to pad the whole input as one string.
  5. 5Click Copy or Download in the output header.

Keyboard shortcuts

Drive TextResult without touching the mouse.

Shortcut Action
Ctrl FOpen the find & replace panel inside the input Plus
Ctrl ZUndo the last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor Plus
EscClose find & replace, or exit fullscreen
Ctrl KOpen the command palette to jump to any tool Plus
Ctrl SSave current workflow draft Plus
Ctrl PRun a saved workflow Plus

What this tool actually does

Backed by padStart

The pad call is line.padStart(width, char). JavaScript will repeat the fill char as needed to reach Width; if the line is already long enough, it is returned untouched.

Only the first character of Char is used

If you type ab the fill becomes a. This matches the registry shape (single-char fill) and avoids surprising overflow when the multi-char string does not divide evenly.

Empty Char falls back to space

If Char is left empty the tool substitutes a regular space. There is no way to disable padding while keeping the width number; set Width to 1 for a near-no-op.

Per Line is on by default

Each line is padded independently. Turn the toggle off to pad the whole input as one string; line breaks then count toward the width and are usually undesired.

Width is bounded 1 to 200

The registry caps Width at 200 to keep the output reasonable. Beyond that, manual extension or a piped run is the better path.

Worked example

Width 8, Char 0, Per Line on. Each numeric line is zero-padded to eight characters, ready for filename or sort-key use.

Input
1
23
456
7890
Output
00000001
00000023
00000456
00007890

Settings reference

Behaviour Effect on output
Width (1-200) Target column count. Lines below the width grow; lines at or above pass through.
Char populated First character is used as the fill. Multi-char input is truncated to the first char.
Char empty Falls back to a single space.
Per Line on (default) Each line is padded independently; line breaks are preserved.
Per Line off The whole input is padded as one string; line breaks count toward the width.
Line already at or above width Returned unchanged.
Line endings CRLF input becomes LF output (split/join in per-line mode).

FAQ

How do I zero-pad numeric IDs?
Set Char to 0 and Width to your target length. 1 becomes 0001 at width 4, 23 becomes 00000023 at width 8.
Why does Char only use one character?
The pad call is padStart(width, char) and the registry treats the field as a single fill char. The implementation takes char.charAt(0) to keep behaviour predictable.
What if my line is already wider than Width?
It is returned unchanged. padStart never truncates; if you want shortening use truncate text.
How do I pad the right side instead?
Use pad right. Same options, opposite side.
Does anything upload?
No. padStart runs in your browser. Your text never leaves the page.