Text Tools

Text Padding

Pad lines of text to a fixed character width using custom characters and alignment options.

Run tool

The text padding utility formats multiline plain text by extending short lines to a fixed character width using a chosen fill character. Each line separated by standard line breaks is processed independently. When a line contains fewer characters than the target width setting, the tool appends or prepends the padding character until the line reaches the required length. You can position the padding to align text along the left edge, align it along the right edge, or center it evenly across the column. For centered text with an odd number of fill characters, the extra character is placed on the right side. Lines that already meet or exceed the target width remain completely intact and are not shortened or truncated. The tool accepts column widths from 1 to 200 characters and defaults to a 20-character width with standard space padding when specific parameters are omitted. Empty inputs produce an empty output cleanly.

Instructions

  1. Enter or paste your multiline text into the Text area.
  2. Set the target line width between 1 and 200 characters.
  3. Specify a padding character, or leave it blank to use standard spaces.
  4. Choose left, right, or center alignment to control where padding is added.
  5. Run the tool to view your padded text in the output area.

Examples

  • Left padding to width 10 with spaces: entering the text 'Item' with width 10 and right alignment yields ' Item'.
  • Centering text with dashes: entering 'Title' with width 11, pad character '-', and center alignment yields '---Title---'.
  • Zero-padding numeric lines: entering '42' with width 5, pad character '0', and right alignment yields '00042'.

FAQ

What happens if a line is already longer than the specified width?

Lines that meet or exceed the specified width are preserved exactly as entered and are not shortened or truncated.

What character is used if multiple characters are entered in the padding character field?

Only the first character of the entered text is used as the repeating padding character.

How does the tool handle odd numbers of padding characters when centering text?

When an odd number of padding characters is required for centering, the smaller portion is placed on the left and the larger portion on the right.

What default values are applied if fields are left empty?

An omitted width defaults to 20 characters, the padding character defaults to a single space, and alignment defaults to left placement.

Embed this tool

Add this working SmartPlusLab tool to your website with the code below.