Markdown Table Formatter

Paste a ragged markdown table and get back a beautifully aligned one — or a compact variant, or clean HTML table markup. Runs entirely in your browser.

Tables are formatted locally in your browser. Nothing ever leaves your device.

—

How It Works

Your text is scanned line by line for the one row that proves a table exists: a separator row like |---|:--:| whose cells contain only dashes with optional flanking colons. The line above becomes the header, every later line containing an unescaped pipe becomes a body row, and pipes escaped as \| are treated as cell content, never as delimiters.

Column width algorithm
Cells are trimmed, then each column's width is the longest of its header and body cells (never below 3, so the separator can hold its colons). Padded output emits each cell left-anchored inside those fixed widths — | name | age | — while compact output drops the padding and keeps a single space around content, which is the smallest table that still reads cleanly in source.
Alignment semantics
The separator row is the table's stylesheet: :--- left, ---: right, :---: center, plain --- default. Alignment survives re-padding — the colons are re-emitted to match the new widths — and missing cells in short rows are padded out, extra cells in long rows are placed into the established columns.
The HTML flavor
HTML output builds <table><thead><tr><th> markup with each column's alignment as an inline text-align style. Cell text is entity-escaped for & < >, literal \| escapes are unwrapped since pipes are not special in HTML, and inline Markdown like backticks is intentionally left untouched — this is a table formatter, not a Markdown renderer.

Frequently Asked Questions

Why does my table break when a cell contains a pipe?

The pipe is the column delimiter, so any bare | inside a cell ends the cell early and shifts every later column. Escape it as \| — the formatter understands the escape and keeps it on output, so Markdown renderers show a literal pipe. A robust habit for code samples is wrapping them in backticks, but even inside inline code you still need the backslash-pipe in a table cell.

What do the colons in the separator row mean?

They are the alignment directives: :--- left-aligns the column, ---: right-aligns it, and :---: centers it. A plain --- leaves the column at the renderer's default. The formatter reads these from your separator row and reproduces them exactly in the output, padded or compact, and translates them into text-align styles in the HTML flavor.

Is padded alignment actually necessary?

No — any CommonMark renderer accepts a ragged table. Padding is purely for humans: aligned columns make the source readable in a terminal, a pull request diff or a printout, and edits to one cell stop creating noisy whitespace diffs. Use Compact when you care about bytes over looks, Padded when a person will read the source.

Can I just convert the table to full HTML instead?

This tool emits a self-contained <table> markup as one output flavor, which covers tables. For converting whole Markdown documents — headings, lists, code fences and all — use the Markdown to HTML converter on this site instead; this formatter is about tidying table structure, not rendering prose.

Is anything uploaded to a server?

No. The parsing and re-padding are plain string operations in vanilla JavaScript inside your browser tab. Your table never leaves your device, there is no account and no network request involved in formatting.