The Markdown table generator gives you a grid to type in or paste spreadsheet cells into, and writes the Markdown: pipes, dashes, alignment and escapes included.
Open the table generatorBuild the table in a grid instead
- Open the generator. Type the header row first, then the rows below. Add rows and columns as you go.
- Set each column's alignment. Left, centre or right. Right suits numbers, so the digits line up.
- Copy the Markdown. Paste it into a README, an issue, a wiki page or a chat message.
Line up columns pads every cell so the raw Markdown is readable in a text editor or a code review. It doesn't change how the table looks once rendered, so untick it if you want the shortest text.
Paste from Excel or Google Sheets
When you copy cells from a spreadsheet, the clipboard holds them as text with a tab between cells and a line break between rows. That is already a table; it just needs converting. Copy this range from a sheet:
| Plan | Price | Notes |
|---|---|---|
| Free | 0 | Up to 3 users |
| Team | 12.50 | SSO | audit log |
Paste it into the generator's grid, set the Price column to right-aligned, and the Markdown comes out like this:
| Plan | Price | Notes |
| ---- | ----: | ---------------- |
| Free | 0 | Up to 3 users |
| Team | 12.50 | SSO \| audit log |The pipe inside “SSO | audit log” is escaped so it stays in its cell, and the colon in ----: right-aligns the prices. For a whole workbook or a CSV file, use Excel to Markdown, which opens the file, lets you choose the sheet and right-aligns number columns for you.
The syntax, for when you edit by hand
- The first line is the header row. Cells are separated by
|. - The second line is the delimiter row: one cell of hyphens per column. GitHub's documentation asks for at least three hyphens per cell. A colon sets alignment:
:---left,:---:centre,---:right. - The header row and the delimiter row must have the same number of cells, or there is no table.
- Pipes at the start and end of a row are optional, but they make the table easier to read and edit.
- The cells don't have to line up in the source. Padding is for people, not for the renderer.
Pipes, line breaks and other things inside cells
A pipe in a cell. Write it as \|. The GitHub Flavored Markdown spec says this works inside code spans too, so `a \| b` shows as the code a | b. An HTML entity such as | also works in plain text, but inside backticks it is shown literally.
A line break in a cell. A table row must stay on one line, so write <br> where the break goes. GitHub and most renderers show it as a new line inside the cell. The generator does this for you when a pasted cell contains a line break.
Lists, headings and code blocks. These can't go in a cell. Keep cells short, and put longer content below the table with a reference to it.
When a table won't render
- No blank line before it. A table directly under a paragraph can be read as part of that paragraph. GitHub's docs ask for a blank line before the table.
- Cell counts don't match. Count the cells in the header and the delimiter row. A missing
|---is the usual cause. - Inside a code block. A table indented by four spaces, or inside
```fences, is shown as code. AI answers sometimes do this on purpose so you can copy the source. - An unescaped pipe in a cell. The row gets an extra column. Escape the pipe as
\|. - The renderer doesn't support tables. Tables are a GitHub extension, not part of core CommonMark. Check the result in the Markdown viewer, which uses GitHub's rules.
Sources
- GitHub Flavored Markdown spec: Tables (extension). Delimiter row, alignment and escaped pipes
- GitHub Docs: Organizing information with tables. Blank line before the table, three hyphens per column