PicoToolkit
Extracted data:
View Settings
Applies to real TAB characters.
0 characters
0 without spaces
0 words
0 lines
IndexValue
No matching items found
Spotted a bug or have an idea for a new feature? Let us know here »

StrPad Online

Pad Text - Add characters to each line to match the target length.

Pad text — add characters to each line to match a target length

StrPad on PicoToolkit pads each line of your text to a fixed length (left, right, or both). Use it to align columns, zero-pad IDs, or normalize filenames without writing code.

How to use

example usage

  1. Paste your text into the input area.
  2. Open the menu: Edit → Pad String.
  3. Enter the character(s) to use for padding (space, dot, 0, etc.). Multi-character pads repeat as needed.
  4. Set the target length (number of characters per line).
  5. Choose the side: left, right, or both.
  6. Click Pad String to apply padding.
  • Behavior for longer lines: lines that are already longer than (or equal to) the target length are left unchanged — the tool does not truncate.
  • Input limits: no fixed size limit shown — the tool can handle as much text as your browser and device memory permit.
  • Empty lines: preserved unless you remove them before padding.

Common use cases

  • Zero-pad numeric IDs (invoice numbers, order IDs) to a uniform width for consistent sorting and legacy system imports.
  • Prepare fixed-width exports or plain-text reports where columns must line up in a monospaced viewer.
  • Normalize product SKUs or filenames to a fixed length for catalog imports and automated matching.
  • Center or visually align short labels in documentation or CLI output using both-side padding.

Examples

1) Left zero-pad order IDs to 10 digits (common for CSV imports):

Input:
12
305
47890

Pad: "0", target length: 10, side: left
Output:
0000000012
0000000305
0000047890

2) Right-pad product SKUs to 12 characters for a fixed-width export (use spaces in real exports; dots shown here to visualize):

Input:
SKU123
X9
LONGSKU12345

Pad: " ", target length: 12, side: right
Output:
"SKU123     "
"X9         "
"LONGSKU12345"

Note: lines already >= target length (like LONGSKU12345) are left unchanged.

3) Center short labels inside a 20-character column (both-side padding):

Input:
Apple
Banana
Kiwi

Pad: " ", target length: 20, side: both
Output:
"       Apple        "
"       Banana       "
"        Kiwi        "

4) Multi-character pad string and truncation of the final repeat:

Input:
A
BC

Pad: "-+", target length: 5, side: right
Output:
A-+-+
BC-+-

The pad string repeats until the target length is reached; the last repetition may be cut to fit exactly.

Tips & edge cases

  • If you don't want leading/trailing spaces counted, run Trim first.
  • To pick a target length based on your data, use Find the longest line or Character Counter.
  • Multi-character pad strings repeat until the target length is reached; the last repetition may be truncated to fit.
  • Combine tools: add line numbers with Add Line Numbers then pad IDs, or add prefixes/suffixes with Add prefix or suffix.
  • Large inputs depend on browser memory — split very large files if the browser becomes slow.

Related tools

FAQ

Does the tool truncate longer lines?

No. Lines that are already equal to or longer than the chosen target length are left unchanged. If you need truncation, trim or manually shorten lines before using StrPad.

Can I use multi-character pad strings?

Yes. The pad string repeats to fill the needed characters; the final repeat may be cut off to match the exact target length.

Are there input size limits?

There is no explicit server-side limit shown. The tool will process as much text as your browser and device can handle. For very large files, split the input or use a desktop script to avoid browser memory issues.

PicoToolkit evolves fast. Stay ahead.

Get early access to new tools, features, and productivity upgrades.

We email you occasionally. You can unsubscribe anytime.
© PicoToolkit 2022-2026 All rights reserved. Before using this website read and accept terms of use and privacy policy. Icons by Icons8