Markdown Table Syntax: Alignment, Pipes, Line Breaks and Merged Cells
How to write a Markdown table, align columns, escape pipes, add line breaks in cells, and what works on GitHub, Notion, Slack, Confluence and Jira. Includes a fix table for tables that will not render.
A Markdown table is rows of text separated by pipe characters, with a divider row under the header. That is all of it. Most of the trouble people have comes from four things: the divider row, pipes inside cells, line breaks inside cells, and platforms that do not support tables at all. This page covers the syntax and then those four problems.
Need the table made for you? Use the table creator, paste a spreadsheet with Sheets to Markdown, convert a file with CSV to Markdown, or tidy a messy one with the table formatter.
The basic syntax
| Name | Role | Age |
| ----- | -------- | --- |
| Alice | Engineer | 31 |
| Bob | Designer | 27 |
Rules that matter:
- The second row is required. It needs at least three hyphens per column in some parsers, so use three.
- Every row should have the same number of cells as the header. GitHub pads short rows and drops extra cells, other parsers may refuse to render the table.
- The outer pipes are optional in GFM, but keep them. Tables without them are harder to read and break in some tools.
- You do not need to align the pipes. It only helps humans reading the source.
- A table must be separated from the paragraph above it by a blank line.
Column alignment
Colons in the divider row set alignment.
| Left | Center | Right |
| :--- | :----: | ----: |
| a | b | c |
| Divider | Alignment |
|---|---|
--- or :--- |
Left (default) |
:---: |
Center |
---: |
Right |
Right-align numbers so decimals line up. There is no way to set column widths or vertical alignment in pure Markdown. If you need them, see the text alignment guide or use HTML.
Pipes inside a cell
A | in cell text ends the cell. Escape it with a backslash.
| Operator | Meaning |
| -------- | ------- |
| `a \| b` | bitwise OR |
| `a \|\| b` | logical OR |
GitHub handles the backslash even inside inline code. Other renderers keep the backslash visible inside backticks. If that matters, use the HTML entity | outside of code.
Line breaks inside a cell
Markdown tables are one line per row, so you cannot press Enter inside a cell. Use <br>.
| Step | Notes |
| ---- | ----- |
| Install | Run the installer.<br>Restart your shell. |
This works on GitHub, GitLab, VS Code, Obsidian and most static site generators. It does not work where HTML is stripped, such as Slack and some chat apps. Lists inside cells need HTML too (<ul><li>), because Markdown list syntax does not work inside a cell.
Merged cells and spanning
GFM tables have no colspan or rowspan. Your options:
- Write the table in HTML with
colspanandrowspan. GitHub renders it, but it can be long to maintain. - Repeat the value in each cell.
- Use a renderer extension. MultiMarkdown and Pandoc support some spanning, and most other tools do not.
The cell merging guide covers the HTML approach with working examples.
Formatting inside cells
Inline formatting works: bold, italic, code, links, images, and strikethrough on GFM. Block elements do not: no headings, no fenced code blocks, no blockquotes, no real lists.
| Command | What it does |
| ------- | ------------ |
| `git status` | Shows **changed** files |
| `git diff` | Shows [unstaged changes](https://git-scm.com/docs/git-diff) |
Where tables work
| Platform | Tables | Notes |
|---|---|---|
| GitHub, GitLab | Yes | GFM. <br> works in cells. |
| VS Code preview, Obsidian | Yes | Obsidian also has a table editor. |
| Notion | Yes on paste | Pasted Markdown becomes a native table. |
| Confluence | Not as Markdown | Use wiki markup. See the Markdown to Confluence converter. |
| Jira | Not as Markdown | Uses its own ||header|| syntax. See the Jira converter. |
| Slack | No | Posts raw pipes. Use a code block or the Slack formatter. |
| Discord | No | Put the table in a code block. |
| Original Markdown (Gruber) | No | Tables are an extension, not core syntax. |
Why my table does not render
| Symptom | Cause | Fix |
|---|---|---|
| Shows raw pipes | No blank line above the table | Add a blank line |
| Shows raw pipes | Divider row missing or malformed | Use | --- | --- | with the right column count |
| Header row looks like data | Divider row column count differs from header | Make both rows the same width |
| Cell splits in two | Unescaped | in text |
Write | |
| Row is cut off | Row has more cells than the header | Remove extras or add a header column |
| Table inside a list is plain text | Table not indented to the list item's text column | Indent every table line to match the item text |
| Works on GitHub, not elsewhere | Renderer is core Markdown only | Enable tables or switch to HTML |