Markdown Table Formatter
Paste a ragged Markdown table — uneven pipes, missing spaces, mismatched dashes — and get back a tidy version with every column aligned and the separator row rebuilt correctly. Choose a pretty aligned layout or a minimal compact one, and force a column alignment if you like. It formats live and runs on your device.
How to use the Markdown Table Formatter
Paste your table into the Markdown table box. The first non-empty line is treated as the header, the next line as the separator (the row of dashes and colons), and the rest as body rows. The tool re-emits the table with consistent pipes and spacing, updating live, and you can Copy table when it looks right. If your paste is missing a separator row, one is added automatically so a plain set of pipe rows still formats.
The Layout control picks the style. Pretty measures the widest cell in each column and pads every cell to that width, producing a neatly aligned grid that is pleasant to read in raw text. Compact strips the padding down to a single space on each side for the smallest valid table, which is handy when you care about a small diff rather than readability. Either way the output renders identically once Markdown is processed — alignment in the source does not change the final HTML.
The Column alignment control governs the colons in the separator row, which is what actually decides how a renderer aligns each column. Preserve from source keeps whatever your separator specified (:-- left, :-: center, --: right), while the force options apply one alignment to every column. Everything is computed in your browser, so nothing you paste is uploaded.
How Markdown tables actually work
Markdown tables, popularized by GitHub Flavored Markdown, are built from three ingredients: a header row, a delimiter row, and zero or more body rows, with cells separated by pipe characters. The crucial and often misunderstood piece is the delimiter row — the line of dashes that sits between the header and the body. It is not decoration; it is what tells the parser this is a table at all, and its colons set the alignment of each column. A cell written as :--- is left-aligned, ---: is right-aligned, :--: is centered, and a plain --- leaves alignment to the renderer's default. Get that row wrong and the whole block renders as ordinary text instead of a grid.
What trips people up is that the visual alignment of the source has no effect on the output. You can pad every column so the raw text looks like a perfect grid, or you can cram everything together with single pipes, and a Markdown renderer produces exactly the same HTML table either way. The padding exists purely for the human reading the .md file. That is liberating — you never have to hand-align anything for correctness — but it also means that as soon as you add a row with a longer value, your carefully spaced columns fall out of alignment and the file looks messy even though it still renders fine. Re-aligning by hand after every edit is tedious busywork.
This is exactly the gap a formatter fills, and it mirrors what editor plugins and prettier do for Markdown. To pretty-print a table you parse the rows into cells, being careful to respect escaped pipes (\|) that are literal content rather than separators, find the maximum width in each column, and then pad every cell to that width according to its alignment — text pushed left, right, or centered. The delimiter row is regenerated to match the column widths with the correct colon placement, so the dashes line up with the data above and below them. The compact direction does the opposite, squeezing out the padding for a minimal representation that produces the smallest possible diff in version control. Because the rendered result is identical, you are free to choose whichever serves you: an aligned grid that is a joy to read in the raw file, or a terse form that keeps commits clean. Either way, letting a tool handle the pipes and padding means you can paste a table copied from a spreadsheet or a half-edited mess and get back something correct and consistent in one step.
Common use cases
- Tidy READMEs. Re-align a table after editing so the raw Markdown stays readable.
- Fix pasted tables. Turn a rough paste of pipe rows into a valid, aligned table.
- Set alignment. Force whole columns left, center, or right via the separator colons.
- Clean diffs. Use compact mode for the smallest possible table in version control.