Right Aligner

Pads every line on the left with spaces so it right-aligns within a fixed-width column, like the numeric column of a plain-text table or report. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-22

Overview

Introduction

Plain-text tables and reports often need a numeric or short-text column right-aligned for readability.

This tool applies that alignment to every line of your input at once.

What Is Right Aligner?

A line-by-line right-aligner that space-pads each line on the left to a fixed column width, so shorter lines line up flush-right against longer ones.

It runs entirely client-side as part of this site's String Tools collection, so nothing you paste is ever uploaded to a server.

How Right Aligner Works

Input is split into lines, and each line is individually padded on the left with spaces to the target width using padStart().

The transformation happens synchronously in JavaScript the moment you type, with no network round trip involved.

When To Use Right Aligner

Use it when formatting a plain-text table's numeric column, or aligning a list of short codes for a monospace display.

It's a fast way to get the answer without opening a code editor, a REPL, or writing a one-off script just to check.

Often used alongside Left Padder and Center Aligner.

Features

Advantages

  • Processes every line at once instead of padding each individually.
  • Uses spaces specifically, matching typical visual-alignment expectations.

Limitations

  • Only pads with spaces; use Left-pad a String if you need a different pad character.
  • Assumes a monospace font for the alignment to actually look aligned.

Examples

Aligning a short numeric column

Input

1
22
333

Output

       1
      22
     333

Each line is right-aligned within an 8-character column.

Best Practices & Notes

Best Practices

  • View the result in a monospace font; proportional fonts won't show true visual alignment.

Developer Notes

Each line is padded independently via padStart(width, " "), rather than padding the whole multi-line string as one unit, which would incorrectly measure length across newlines.

Right Aligner Use Cases

  • Right-aligning a numeric column in a plain-text report
  • Aligning short codes for a monospace terminal display
  • Formatting output for a fixed-width log format

Common Mistakes

  • Viewing the output in a proportional font, where alignment won't visually line up.

Tips

  • Use Left-pad a String instead if you need a non-space pad character.

References

Frequently Asked Questions