The three rows every GitHub table needs
The first row holds the column names. The second row is the delimiter row. It tells GitHub that the lines form a table. Each delimiter cell needs at least three hyphens. The header row and the delimiter row must have the same number of cells. If the counts differ, GitHub shows the lines as plain text. Body rows can have a different number of cells. GitHub adds empty cells to a short row and ignores extra cells in a long row. The table ends at the first blank line, or where another block such as a heading or a list starts. Spaces around the pipes do not change the output, so align the source only if it helps people read the raw file.
Align columns and format cells
Alignment goes in the delimiter row, not in the cells. A colon on the left (:---) aligns the column left. Colons on both sides (:---:) center it. A colon on the right (---:) aligns it right, which suits numbers and prices. A cell can hold inline formatting: bold, italic, inline code, and links. A cell cannot hold a block. Lists, headings, fenced code blocks, and blockquotes do not work inside a cell. For a line break inside a cell, use the HTML tag <br>. For a multi-line list in a cell, write the items on one line and separate them with <br>. Keep each row on one line in the source, because a line break ends the row.
Fix a table that does not render
Check four things in this order. First, look for a blank line above the table. A table directly under a paragraph line is the most common failure. Second, count the cells in the header row and the delimiter row. They must match. Third, check each delimiter cell for at least three hyphens. Fourth, look for a pipe character inside a cell. GitHub reads an unescaped pipe as a new column. Write \| to show a literal pipe, also inside inline code. If the table still breaks, paste it into a Markdown table formatter. The formatter rebuilds the rows with equal cell counts and a valid delimiter row.
How do you do it step by step?
- 1Leave a blank line after the paragraph above the table.
- 2Write the header row with the column names between pipes: | Name | Status |.
- 3Write the delimiter row with at least three hyphens per column, and add colons for alignment: | :--- | ---: |.
- 4Write one body row per line, and escape any pipe inside a cell as \|.
- 5Open the Preview tab on GitHub and check that every column shows.
Working example
This table lists three services. The Port column is right-aligned, and one cell holds a literal pipe.
| Service | Command | Port | | :--- | :--- | ---: | | API | `npm start` | 8080 | | Worker | `node worker.js \| tee log` | 9000 | | Docs | [Open](docs/README.md) | 3000 |
A three-column table. Service and Command are left-aligned. Port is right-aligned. The Worker command shows node worker.js | tee log as inline code, with a literal pipe.
Without the backslash, GitHub reads the pipe in the Worker row as a fourth cell and the command breaks into two columns.
Frequently asked questions
- Why is my GitHub Markdown table not showing?
- The usual cause is a missing blank line above the table. Other causes are a header row and delimiter row with different cell counts, or a delimiter cell with fewer than three hyphens.
- How do I center a column in a GitHub table?
- Put a colon on both sides of the hyphens in that column's delimiter cell: :---:. Use ---: to align the column right.
- How do I put a pipe character in a table cell?
- Escape it with a backslash: \|. GitHub shows a pipe and does not start a new column. This also works inside inline code in a cell.
- Can I make a GitHub table without a header row?
- No. GitHub Flavored Markdown needs a header row and a delimiter row. You can leave the header cells empty, but the row must be there.
- Can a GitHub table cell hold a list or code block?
- No. Cells hold inline content only. Use <br> for line breaks inside a cell, or move the list or code block below the table.