The Complete Guide to Markdown Tables (2026)

Markdown tables look simple — three pipes and you're done. The reality is alignment quirks, paste-from-Excel pain, and rendering differences across GitHub, Reddit, Notion, and Obsidian. Here's the complete reference, and the workflow that gets you to a clean table in under a minute.

What a markdown table actually is

A markdown table is text. Three things make it a table: a header row, a separator row of dashes, and one or more data rows. Pipes separate cells. The renderer reads the structure and emits an HTML <table> with thead and tbody.

| Column A | Column B | Column C |
|----------|----------|----------|
| Cell 1   | Cell 2   | Cell 3   |
| Cell 4   | Cell 5   | Cell 6   |

The leading and trailing pipes are technically optional in many parsers — but include them. Reddit, Discord, and a few static-site generators require them. Use them everywhere and avoid the cross-platform headache.

Alignment — the one place subtle syntax matters

The separator row controls column alignment. Three patterns:

  • :---- — left-aligned (default if no colon)
  • ----: — right-aligned
  • :----: — centered

Numbers should be right-aligned. Headers naming countable things should usually be centered. Body text is left-aligned. Get this right once and every table on the site reads better:

| Item     | Quantity | Price    |
|:---------|---------:|---------:|
| Coffee   |        2 |   $7.00  |
| Pastry   |        3 |   $12.00 |

Escaping — pipes, backslashes, and line breaks

Three characters cause real trouble inside cells.

Pipes. A literal pipe character inside a cell will be parsed as a column boundary. Two ways to escape: the HTML entity &#124; or a backslash \|. Most modern parsers accept both. The TextKit Markdown Table tool auto-escapes pipes you type or paste.

Backslashes. Already special in markdown for escaping. To produce a literal backslash, double it: \\.

Line breaks. Markdown tables can't contain literal newlines inside cells. To force a line break, use <br> — the parser passes it through as raw HTML. This is the only place the inline HTML escape hatch is unavoidable.

The paste-from-spreadsheet workflow

Most tables don't get hand-typed. They get pasted from Excel, Google Sheets, Numbers, or a CSV export. Both Excel and Sheets place the copied range on the clipboard as tab-separated text. The conversion to markdown is mechanical: replace tabs with |, add a separator row, optionally wrap with leading and trailing pipes.

Skip the conversion. The Markdown Table tool reads tab-separated text from your clipboard and emits clean markdown — alignment, escaping, and pipe boundaries all handled.

The shortcut: copy a range from Excel, click "Paste from spreadsheet" in the tool, click "Copy markdown." Five seconds.

Rendering — where each platform differs

Markdown is a spec, but every renderer interprets the edge cases differently. The differences that matter in practice:

PlatformRequired leading/trailing pipesAlignment supportedHTML inside cells
GitHub Flavored MarkdownNoYes (colons)Yes
RedditYesYes (colons)No
DiscordYesLimitedNo
Notion (paste)NoAuto-detectedLimited
ObsidianNoYesYes
MkDocs (Material)NoYesYes
DocusaurusNoYesYes (MDX)
Stack OverflowYesYesNo

The safe-everywhere defaults: leading and trailing pipes, explicit alignment with colons, no HTML inside cells, separator row exactly matches header column count. A table built this way will render in every markdown environment encountered in 2026.

The five mistakes that cause 90% of broken tables

  1. Mismatched column counts. Three header columns, four cells in row two. Most renderers silently drop or duplicate cells. Always run a quick count before publishing.
  2. Missing separator row. Without the dash row, the renderer treats the entire block as paragraphs. Easy to forget when hand-typing a small table.
  3. Spaces inside dashes. The separator row is |---|---|, not |- - -|- - -|. The latter is a paragraph with literal dashes.
  4. Tab characters from a half-done paste. Tabs aren't pipes. If your "table" contains tabs instead of pipes, no markdown parser will recognize it. Always run a find-and-replace to convert.
  5. Pipes inside URLs. Some URLs (rare but it happens) contain literal |. Always URL-encode them as %7C before placing inside a markdown table cell.

When to use a table vs a list

A table works when every row has the same set of attributes. A list works when items have varying or partial attributes. The discipline test: if more than one column would be empty for any row, the data probably isn't tabular.

Tables also become unreadable past ~6 columns on a desktop and ~3 on mobile. Past that point, switch to a definition list (<dl>) or convert each row into its own card or paragraph block.

Tables in technical documentation specifically

For API docs, configuration references, and CLI flag listings, tables are usually the right choice. The convention that's emerged across the major doc frameworks:

  • Column 1: identifier (parameter name, flag name, key) — left-aligned, monospaced via inline backticks.
  • Column 2: type (string, boolean, number) — left-aligned.
  • Column 3: required vs optional — centered, plain text.
  • Column 4: default value — left-aligned, monospaced.
  • Column 5: description — left-aligned, plain prose, often the widest column.

This pattern is what every docs reader expects. Deviating from it slows the reader.

Markdown tables vs HTML tables — when to drop down

Markdown tables are easier to read in source but lose to HTML tables on three things: row/column spans, complex alignment-per-cell rules, and styling. If a table needs any of those, drop into raw HTML inside the markdown document. The Markdown vs HTML Tables deep-dive covers the trade-off in detail.

The cheatsheet

  • Header row + separator row + data rows.
  • Leading and trailing pipes everywhere — costs nothing, fixes Reddit and Discord.
  • Colons in the separator row control alignment.
  • Right-align numbers. Left-align text. Center short labels.
  • Escape pipes as &#124; or \| inside cells.
  • Use <br> for line breaks inside a cell.
  • Match column count exactly between header and data rows.
  • Past 6 columns or 3 on mobile, use a different layout.
  • Paste from Excel/Sheets via the Markdown Table tool — it handles TSV, escaping, and alignment in one paste.

For more on the workflow, see How to Make a Markdown Table in 60 Seconds. For a printable reference, see the Markdown Table Cheatsheet. For the trade-off against HTML tables, see Markdown vs HTML Tables.

Frequently asked questions

Do I have to align the pipe characters perfectly?

No. The renderer ignores whitespace inside cells. | a | b | and |a|b| render identically. Aligning pipes is purely a source-readability choice.

How do I escape a literal pipe character inside a cell?

Use &#124; (the HTML entity) or backslash-escape: \|. Most parsers accept both. The TextKit Markdown Table tool auto-escapes pipes for you.

Can markdown tables have merged cells?

Plain markdown — no. Merged cells aren't part of the spec. If you need rowspan or colspan, drop into raw HTML inside the markdown document. GitHub, GitLab, and most static-site generators allow this.

Why does my table look fine on GitHub but break on Reddit?

Reddit's table parser is stricter. It requires a blank line before the table and a separator row that exactly matches the header column count. Pad short separator rows to match.

How do I paste a table from Excel or Google Sheets?

Excel and Sheets copy as tab-separated text. Use a markdown table generator that detects TSV and converts it — paste directly into the editor and the markdown comes out the other side. The TextKit tool does this in one click.

Are markdown tables responsive on mobile?

Not natively — wide tables overflow horizontally on narrow viewports. The standard fix is wrapping the rendered HTML table in a scrollable div. Most modern markdown frameworks (MkDocs Material, Docusaurus, GitBook) handle this automatically.

Keep reading

Written by the TextKit team. We build the tools we write about — try the Markdown Table tool used in this post.