← All tools
// TEXT

Center / Right-Align Text online

Center or right-align lines within a column width — with customisable padding character.

Center Text / Right-Align Text logo
by
CHUNKY
MUNSTER
Width: Pad char:
TEXT INPUT0 LINES
OUTPUT0 LINES

About Center / Right-Align Text

Pads each line to the specified column width using the chosen padding character. Center alignment splits padding evenly on both sides. Right alignment pads on the left. Useful for ASCII art, terminal displays, and formatted reports. Runs entirely in your browser.

How to Use the Center / Right-Align Text Tool

  1. Set the column Width (default 80, the classic terminal column width) and choose a Pad character — usually a space, but a dot or dash works for banners.
  2. Paste your lines into the input.
  3. Click Center to split padding evenly on both sides, or Right-Align to push every line to the right edge.
  4. The output is monospace-formatted; copy it into a terminal, README, ASCII banner, or fixed-width report.

This tool fills the gap CSS can't fill: aligning text in environments where every character is the same width. Terminal banners, code comments, ASCII art frames, fixed-width log columns, and README badges all rely on counting characters rather than measuring pixels — and that is exactly what this tool does.

How the Center / Right-Align Tool Works

For each line the tool measures its character length, computes the padding needed to reach the target width, and inserts the chosen pad character. Centring distributes the padding as floor(extra/2) on the left and ceiling(extra/2) on the right — the standard ASCII-art convention. Lines already at or beyond the target width are left untouched so nothing is truncated.

Frequently Asked Questions

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

The line is left exactly as it is — never truncated and never wrapped. Only shorter lines get padded out to the target width.

Can I use a character other than space for padding?

Yes. Set the pad character to anything you like: a dot for dot leaders, an underscore for fill-in-the-blank lines, a dash for separator banners, or any single Unicode glyph.

Will the output look right in a proportional font?

No — alignment is character-based, so it only looks correct in a monospace font (terminals, code editors, fixed-width email). In Times or Arial the columns will drift.

Why does centring with an odd remainder put the extra space on the right?

When the leftover padding is odd, one side gets the extra character. The tool puts that extra on the right (floor on the left, ceiling on the right) — the standard convention for ASCII centring.

See also Text Pad, Whitespace Converter, and the Word Wrap tool for related fixed-width formatting.