Skip to content
Guides

How to format and align a Markdown table

Straighten a ragged Markdown table so its columns line up in the raw source — easier to read, easier to edit, and still valid everywhere.

June 15, 20262 min read
TABLESAlign TableGUIDERAGGED| a |b| |-|--|ALIGNED| a | b | | - | - |Padded columns

A Markdown table renders fine even when its source is a mess of uneven pipes — but editing that mess is painful. Markdown Table Formatter pads every column to a consistent width so the raw table is as readable as the rendered one.

The problem: valid but ragged

After a few hand edits, a table's source often looks like this:

| Name | Role |
|---|---|
| Ada | Engineer |
| Linus | Maintainer |

It renders correctly, but the columns don't line up in the source, so spotting the right cell to edit means counting pipes. The formatter turns it into:

| Name  | Role       |
| ----- | ---------- |
| Ada   | Engineer   |
| Linus | Maintainer |

Same table, far easier to work with.

What it does

  • Pads each column to the width of its longest cell.
  • Normalizes the divider row so the dashes match the columns.
  • Preserves alignment markers (:---, :--:, ---:) so left/center/right stays intact.

Why it matters

  • Reviewable diffs. Aligned tables produce clean, readable diffs in pull requests.
  • Faster editing. You can see which column is which without counting.
  • Consistency. A repo full of tidy tables looks maintained.

Where the table came from

If you're building a table from scratch or from data, the generators do the alignment for you: Markdown Table Generator, CSV to Markdown Table, and friends. The formatter is for tables that already exist and have drifted.

Privacy

Formatting happens in your browser; the table content stays local.

Paste the messy table, get a tidy one, and never count pipes again.

Tags#markdown#table#format#how-to

More from Guides

See all →