Tables are one of the most useful features in Markdown and one of the most annoying to type. A README needs a comparison of configuration options, a pull request description needs a before-and-after list, or a wiki page needs a schedule. You start lining up pipes and dashes by hand, add one long cell, and the whole thing turns into a jagged mess that is painful to edit.
This guide covers the complete syntax for Markdown tables, including alignment and the characters that need escaping, explains why tables sometimes refuse to render, and shows a faster way to build and edit them.
Markdown table syntax
Tables are not part of the original Markdown specification. They come from GitHub Flavored Markdown (GFM), which is now supported by most platforms that render Markdown: GitHub, GitLab, many documentation tools, static site generators and note-taking apps.
A table has three parts:
| Command | Description | Speed |
| --- | --- | --- |
| git status | Show changed files | Fast |
| git gc | Clean up the repository | Slow |
- A header row, with cells separated by pipes
|. - A delimiter row with at least three dashes per column. This row is what makes the parser treat the lines as a table.
- Data rows, one per line.
Leading and trailing pipes are optional, but using them makes tables easier to read and edit. The columns do not need to line up in the source; the output is the same either way. Aligning them is purely for humans reading the raw text.
Column alignment
Colons in the delimiter row set the alignment of each column:
| Delimiter | Alignment |
|---|---|
--- |
Default (usually left) |
:--- |
Left |
:---: |
Centre |
---: |
Right |
For example:
| Item | Qty | Price |
| :--- | :-: | ----: |
| Desk | 1 | 349.00 |
| Chair | 4 | 89.50 |
Right-aligning numeric columns makes them much easier to compare, because the digits line up.
Characters that need care
Pipes inside cells
A | inside a cell ends the cell. Escape it with a backslash: Editor \| Writer. Inside inline code, GitHub's parser also requires the escape, so write `a \| b`.
Line breaks
Each row must be on a single line. To show a line break inside a cell, use the HTML tag <br>, which most renderers allow: First line<br>Second line.
Formatting in cells
Inline formatting works: **bold**, *italic*, `code`, links and images. Block elements do not: you cannot put a list, a heading or a fenced code block inside a cell.
Build a table with the Markdown Table Generator
Our Markdown Table Generator gives you a spreadsheet-like grid and writes the Markdown for you.
- Open the Markdown Table Generator. A sample table of Git commands is loaded.
- Type into the grid cells. The first row is always the header. Use Add row, Add column and the remove buttons to change the size, or Clear cells to start fresh.
- Set alignment per column with the small buttons above each column: Default alignment, Align left, Align centre or Align right. The delimiter row updates with the right colons.
- To bring in data from Excel, Google Sheets or Numbers, click Paste from spreadsheet, paste the copied cells (or CSV text), and click Replace table with pasted data.
- To edit a table you already have, click Import Markdown table, paste it, and click Load into editor. Existing alignment is detected and pipes escaped with
\|are read correctly. - Leave Align pipes (pretty print) on to pad cells so the columns line up in the source, or turn it off for compact output. Wide characters such as Chinese, Japanese and Korean text and emoji are counted as two columns so the alignment stays straight.
- Check the Preview, then copy the Markdown table or download it as
table.md.
Pipes inside cells are escaped automatically, and line breaks in a cell become <br>.
Why a Markdown table does not render
Missing delimiter row
Without the | --- | row directly under the header, the lines are just text with pipes in them.
No blank line before the table
Many parsers need a blank line between a paragraph and a table. If the table appears as part of the previous paragraph, add an empty line above it.
Different number of cells
Rows with fewer cells than the header are usually padded with empty cells, and extra cells are ignored, but some parsers are stricter. Keep every row the same width.
The platform does not support tables
Some chat tools, comment systems and older Markdown libraries implement only the original syntax. In that case, convert the table to HTML with Markdown to HTML, or use the HTML Table Generator directly if the platform accepts HTML.
Other ways to create Markdown tables
Editor extensions
VS Code and other editors have extensions that format tables when you press a shortcut, and some Markdown editors (Typora, Obsidian and similar) provide table editing modes. These are ideal if you write Markdown daily in one editor.
Converting data files
For data already in CSV, you can paste it straight into the generator. If you need the data in other formats as well, CSV to JSON converts it for code.
Pandoc
Pandoc can convert spreadsheets saved as CSV, or HTML tables, into Markdown pipe tables from the command line. It is the best option for batch conversions.
Tips for readable tables
- Keep tables small. A Markdown table with more than five or six columns becomes hard to read on narrow screens and in raw form. Consider splitting it.
- Put units in headers. "Size (MB)" in the header is cleaner than "MB" in every cell.
- Use code formatting for commands and values, so readers can tell literal text from description.
- Check the result in Markdown Preview before committing, especially if cells contain pipes or HTML.
Frequently asked questions
How do I align a column to the right in Markdown?
Put a colon at the right end of that column's delimiter, like ---:. A colon on both ends centres it, and a colon on the left aligns left.
How do I put a pipe character inside a Markdown table cell?
Escape it with a backslash, as \|. The generator does this automatically for any pipe you type in a cell.
Can I add a line break inside a table cell?
Not with a normal newline, because each row must be on one line. Use <br> instead, which most Markdown renderers accept.
Can Markdown tables merge cells?
No. GFM tables have no syntax for merged cells. If you need them, write the table in HTML inside your Markdown file.
Do I need to line up the pipes?
No. Alignment in the source is only for readability; the rendered table looks the same. Turn off pretty printing if you prefer compact output.