Skip to content
NMSnabbit.

Center Text Online

Center plain text in a fixed column width by padding each line.

Text Tools Runs in your browser

How do you center text online?

Centering plain text means padding each line with leading spaces until it sits mid-column. Feed in “menu” at the fixed 80-column width and it comes back with 38 spaces in front. Lines are trimmed and measured first, so stray indentation can’t skew the arithmetic. Useful anywhere CSS can’t reach: README headings, code comments, terminal banners.

How to use the Center Text

  1. 1 Drop your headings or banner lines into the input.
  2. 2 Each line is trimmed, then padded left until it sits mid-way across 80 columns.
  3. 3 Blank lines pass through untouched; anything wider than 80 columns is left alone.
  4. 4 Copy the centred block out of the result pane.

What you can use it for

  • Centering headings in README or plain-text files.
  • Building balanced ASCII banners and comments.
  • Formatting terminal or console output.
  • Centering short messages for monospace displays.

Frequently asked questions

How wide is the centering column?
The target is 80 characters, the width terminals and plain-text conventions settled on decades ago. Padding is worked out per line: trim, measure, then add half the leftover space on the left.
Does this work for ASCII art or banners?
For banners built line by line, yes. Each row is centred independently, so a banner whose rows differ in length has every row balanced on its own rather than moved as one shape.
Why use spaces instead of CSS to center?
Because plenty of places render raw text with no styling layer at all: man pages, source comments, .txt files, terminal output. Space padding is the only centring those contexts understand.

Related tools

More Text Tools

More tools like this:

All Text Tools