Markdown Table Formatter
Clean up and align messy Markdown tables, or convert CSV/TSV to Markdown — padded columns, pipe alignment, correct separators. Free, in your browser.
Markdown Table Formatter
Preview the columns and alignment
Cells are shown as typed; inline Markdown such as **bold** is not rendered here.
How to Use the Markdown Table Formatter
Paste your table
Drop in a misaligned Markdown table from an LLM answer, a README or a pull-request comment, or paste CSV or cells copied from a spreadsheet. Ragged rows and missing outer pipes are fine.
Pick the input format
Choose Markdown to clean up an existing table, or CSV / TSV to convert delimited data. Quoted fields with commas or line breaks are read as one cell, and pipes in your data are escaped.
Keep or set the alignment
By default each column keeps the alignment its delimiter row already had. Pick left, center, right or none to set every column at once.
Copy the result
Copy the padded or compact Markdown, or switch the output to CSV to take a Markdown table back to a spreadsheet. Anything the formatter changed is listed under the output.
Readable Tables Without the Manual Pipe Counting
Why Markdown tables drift out of alignment
A Markdown table is just text: a header row, a delimiter row of dashes, and body rows, all separated by the pipe character |. The GitHub Flavored Markdown (GFM) spec, which defines the table syntax GitHub renders, trims the spaces between pipes and cell content, so whether the columns line up in the source makes no difference to the rendered table. That tolerance is convenient when you write, but it means tables decay fast. A model emits a table with no padding. A teammate edits one cell and the columns shift. The rendered output still works, but the source becomes painful to read in a pull request or a plain-text diff.
This formatter restores that source-level readability. It parses every row, measures the widest cell in each column, and pads every cell to that width so the pipes form clean vertical lines. It rebuilds the delimiter row with the alignment markers GFM defines: a colon on the left of the dashes (:---) for left, colons on both sides (:---:) for center, and a colon on the right (---:) for right. The alignment your table already has is kept unless you choose to override it.
"A Markdown table renders fine misaligned — but it gets reviewed in the raw. Clean source is the difference between a glance and a squint."
Widths are measured in columns, not characters
Lining up pipes means counting how wide each cell looks in a monospace editor, and that is not the same as how many characters it holds. Chinese, Japanese and Korean characters, and most emoji, take two columns; an accent added as a combining mark takes none. The formatter uses Unicode's East Asian Width property to count Wide and Fullwidth characters as two, so a column holding 李小龍 is padded to match one holding Ada Lovelace. That lines up in editors whose font draws those characters at exactly double width, which most monospace setups do; if yours does not, the rendered table is unaffected.
The rules it follows
GFM's table section settles the edge cases. A literal pipe inside a cell is written \|, even inside backticks, and the formatter never splits a cell there. The header row and the delimiter row must have the same number of cells or no table is recognised, so a missing delimiter row is added. A body row with too few cells gets empty ones. A row with too many has its extra cells dropped when GFM renders it, so the formatter adds empty header columns instead, which keeps the data visible, and tells you it did. CSV is read by RFC 4180's rules, so "Smith, John" stays one cell and doubled quotes become one; a line break inside a cell becomes <br>, because a table row must fit on one line.
Cleaning model and spreadsheet output
Two sources produce the messiest tables. Chat models emit compact tables with no padding, sometimes with a missing outer pipe or an uneven cell count. Spreadsheets put cells on the clipboard as tab-separated values with no pipes at all. Paste either, pick the input format, and the same engine produces a properly piped, padded table. Switching the output to CSV goes the other way, unescaping \| and <br>, and formatting a table it has already formatted changes nothing, so you can run it on your own output safely. Everything runs in your browser; nothing you paste is uploaded.
Only the dashes are required; the padding is for you, not the parser
Tables are an extension in the GFM spec (§4.10), not part of core CommonMark.
The delimiter row is what makes a table; GFM trims the spaces around cell content, so padding only changes the source.
A delimiter cell needs only one hyphen in GFM; three is a readability habit, not a rule.
If the header and delimiter rows have different cell counts, GFM does not render a table at all.
Extra cells in a body row are silently dropped by a GFM renderer; missing ones are filled with empty cells.
A pipe inside backticks still splits the cell unless it is escaped as \|.
Frequently Asked Questions
- It cleans up a messy Markdown table: it pads every column to a consistent display width, lines up the pipes, and rebuilds the delimiter row with the table's own alignment or one you choose. It also converts CSV or spreadsheet cells to a Markdown table, and a Markdown table back to CSV.
- Most count characters, and a CJK character takes two columns in a monospace font. This one counts Unicode East Asian Wide and Fullwidth characters as two, combining accents as none, and an emoji sequence as one two-column glyph, so the pipes line up wherever the font draws those characters at double width.
- A colon in the delimiter row sets a column's alignment:
:---is left,:---:is center and---:is right; no colon leaves it to the renderer. The formatter keeps each column's marker from your input unless you pick one for all columns. - A row with too few cells gets empty ones, as GFM does when it renders. A row with too many would lose its extra cells when rendered, so the formatter adds empty header columns to keep them. Both are listed under the output.
- Yes, written as
\|, and GFM requires that even inside backticks. The formatter never splits a cell at an escaped pipe, and when it converts CSV or TSV it escapes any pipe in your data for you. Converting back to CSV turns\|into a plain pipe again. - No. GFM trims the spaces between pipes and cell content, so padding changes only the source. Choose "compact" output if you want the smallest text instead.
- By RFC 4180: a field in double quotes can hold commas, line breaks and doubled quotes, so "Smith, John" stays one cell. A line break inside a cell becomes <br>, since a table row is one line, and the CSV output turns it back into a line break.
Method & sources
How it computes
Rows split on unescaped pipes and the delimiter row read for alignment per GFM 0.29 §4.10; columns padded to the widest cell in display columns, counting Unicode East Asian Wide/Fullwidth characters as 2 and combining marks as 0; short rows filled, long rows kept by widening the header; CSV/TSV read and written per RFC 4180 (MarkdownTableKernel).
What this tool implements
- Display width uses Unicode EastAsianWidth-18.0.0.txt: W and F code points (plus the unassigned CJK ranges the file defaults to W) count 2; combining marks, format characters and variation selectors 0; a grapheme counts as its widest code point, or 2 for a flag or an emoji-presentation sequence; Ambiguous counts 1 (non-East-Asian reading). The page says alignment depends on the font drawing those characters at double width.
- Excess body cells are kept by adding empty header columns, because a GFM renderer would otherwise drop them; every such change is listed on the page.
- CSV is RFC 4180: quoted fields may hold commas, line breaks and doubled quotes. Pipes in data are escaped as \| and line breaks become <br>; converting back to CSV reverses both. Formatting is idempotent and keeps cells and alignments, pinned by round-trip tests.
- Corrected 2026-11-03: cells split at escaped pipes; input alignment discarded; widths by UTF-16 length (CJK misaligned); naive comma split for CSV and unescaped pipes in converted data; "at least three dashes in most parsers" (GFM needs one hyphen); "tables came from GFM" (they are a GFM extension to CommonMark); the | entity advice and other unsourced facts removed.
Sources
- GitHub. GitHub Flavored Markdown Spec, version 0.29-gfm (2019-04-06), §4.10 Tables (extension): https://github.github.com/gfm/
- Unicode Consortium. Unicode Character Database, EastAsianWidth-18.0.0.txt (East Asian Width property), read 2026-11-03: https://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt
- Shafranovich Y. Common Format and MIME Type for Comma-Separated Values (CSV) Files. RFC 4180. IETF; 2005: https://www.rfc-editor.org/rfc/rfc4180.txt
What can make this go out of date
- None at runtime: everything runs in the browser and nothing pasted is sent anywhere. The East Asian Width ranges are compiled into the kernel from the 18.0.0 data file; a new Unicode version needs the table regenerated.
Pick up where you left off
Stored only in this browser — never sent to our servers.