Markdown tables
Lay out prices, schedules and comparisons in rows and columns using nothing but pipes and dashes. This guide covers the table syntax, with examples you can load into the converter and download as a PDF.
Download PDF opens your browser's print dialog. Choose Save as PDF as the destination.
Your first table
Markdown has no table button, but its table syntax looks like the table it makes, so it's easy to read
even before it's converted. Write each row on its own line and separate the cells with a pipe character,
|. The first row is the header. The second row is made of dashes and tells Markdown that this
is a table rather than a paragraph that happens to contain pipes.
| Day | Session | Room |
| --------- | ------------------ | ---- |
| Monday | Welcome and tour | Hall |
| Tuesday | Writing workshop | 2B |
| Wednesday | Guest speaker | Hall |
The pipes at the start and end of each line are optional, and the columns don't have to line up. These two tables are the same:
| Fruit | Price |
| ----- | ----- |
| Apple | $0.50 |
Fruit | Price
--- | ---
Apple | $0.50
Lining the pipes up only makes the Markdown easier to read and edit; it changes nothing in the PDF. Many code editors can line them up for you, and when an AI assistant writes a table it usually does it already. Leave a blank line after a table, and before it too, which keeps it clearly separate from the text around it.
Aligning columns
Each column is left aligned unless you say otherwise. To change it, add colons to the row of dashes: a colon on the left keeps the column left aligned, one on the right aligns it to the right, and one on each side centers it.
| Item | Qty | Unit price | Total |
| :---------- | :-: | ---------: | ------: |
| Notebook | 3 | $4.50 | $13.50 |
| Pens (pack) | 2 | $6.25 | $12.50 |
| Stapler | 1 | $12.00 | $12.00 |
| **Total** | | | **$38.00** |
Align numbers, and especially money, to the right so the units, tens and hundreds stack up and a column can be added up at a glance. Most md2pdf.me styles also give table figures equal widths, so $12.00 and $38.00 line up digit for digit. Center short values like quantities, ticks or yes and no, and leave text left aligned: centered sentences are hard to read.
What can go in a cell
A cell can hold anything that fits in a line of text: bold, italics, links,
inline code, emoji and inline math. A cell can also be empty; just leave nothing between its
two pipes. A few things need a workaround:
- A pipe inside a cell. Put a backslash in front of it,
\|, so it isn't read as the edge of the cell. This works inside code too, so`a \| b`showsa | b. - A line break inside a cell. Each row has to be one line of Markdown, so you can't
press Enter in the middle of a cell. Use the HTML line break
<br>instead. - Lists, paragraphs and code blocks. These don't fit in a cell. Write
<br>-separated lines with a dash or a bullet character at the start of each to suggest a list, or put the details in a paragraph below the table. - Merged cells. Markdown tables can't span a cell across two columns or rows. Repeat the value, leave the neighbouring cell empty, or split the table in two.
| Plan | Includes | Price |
| ----- | ----------------------------------------- | -----: |
| Basic | Email support<br>5 projects | $9/mo |
| Pro | **Priority** support<br>Unlimited projects | $29/mo |
| Team | Everything in Pro<br>Shared billing \| SSO | $79/mo |
Long tables
A table can run over as many pages as it needs. md2pdf.me breaks it between rows, never through the middle of one, so a row with several lines of text stays together. In Chrome and Edge, the header row is repeated at the top of each new page, so readers of page three still know what each column means.
For a really long table, such as a year of monthly figures or a full inventory, consider whether readers need every row. A short table of totals in the text, with the full detail at the end of the document after a page break, is often easier to follow.
Wide tables
Pages don't scroll sideways, so a table has to fit the width of the page. When a table's content is too wide for the page, md2pdf.me wraps the text inside cells onto more lines, which works well for a column or two of descriptions but makes narrow columns of numbers taller and harder to scan. A table that still doesn't fit is shrunk to the page's width, so its text comes out smaller than the rest of the document, and a larger text size makes that happen sooner. A Letter or A4 page has room for about six columns of short values. Legal paper is longer than Letter, not wider, so switching to it won't help.
If a table is too wide, try these, roughly in this order:
- Shorten the headers. A header is often the widest thing in its column. Qty is narrower than Quantity ordered; explain abbreviations in a sentence above the table.
- Drop or move columns. Notes and descriptions can go in a list after the table, keyed by the first column.
- Turn it on its side. A table comparing three products on ten features is wider with products as rows than with features as rows.
- Split it in two. Two narrower tables with headings beat one cramped one.
The preview shows the page at its real width, so you can see as you type whether a table fits or has
been shrunk. Long web addresses are a common cause of an overfull column, because they have no spaces to
wrap at. Use link text,
[the report](https://…), instead of the bare address.
How tables look in each style
The same Markdown table looks different in each style, so choose the style that suits the document, then check the preview. Every style keeps a table's rows together, and in Chrome and Edge repeats its header across pages.
| Style | Tables look like | Good for |
|---|---|---|
| Classic | Lines above, below and under the header only, small capitals in the header, centered on the page | Essays, letters and anything book-like |
| Academic | Three horizontal lines in the style of a journal, in slightly smaller type, centered | Papers and lecture notes |
| Modern | Full width, a thin line between rows and a small grey header in capitals | Proposals, guides and handouts |
| Report | Full width with a complete grid, a shaded header and sans-serif figures | Business and technical reports with lots of numbers |
| Résumé | Compact, with a single line under the header and no other borders | Skills or certifications laid out in columns |
| Worksheet | Full width in a rounded box in the accent color, with dotted lines between rows and columns | Word lists, schedules and fill-in charts |
| GitHub | A grid with every other row shaded, as on github.com | Technical documentation and READMEs |
| Gothic | Oxblood lines above, below and under the header, small capitals in the header, centered on the page | Stories and game handouts that should look old |
| Sandwake | Heavy lines above and below, spaced typewriter capitals in the header, at the left of the page | Ship rosters, star charts and other science-fiction handouts |
| Elvish | Full width between double green lines, with spaced gold capitals in the header | Invitations, lore and story notes |
| Cyberpunk | Full width in a frame, with a shaded header in teal typewriter capitals | Game handouts and mission briefings |
| Newspaper | Full width, a heavy line above, light lines between rows and spaced capitals in the header | Timetables, results and notices |
| Fiendish | Full width between heavy lines, with thin lines between rows and vermilion capitals in the header | Terms, fees and schedules |
Classic, Academic and Gothic tables are only as wide as their content needs, so a small table sits neatly in the middle of the page; Sandwake's are too, but sit at the left. Modern, Report, Résumé, Worksheet, Elvish, Cyberpunk, Newspaper and Fiendish tables always fill the width of the text, which suits wide tables but spreads a two-column table across the page. If that looks too sparse, a short list may suit the information better than a table. In Newspaper, a table runs across both of its printed columns.
Common mistakes
If a table shows up in the preview as lines of text full of pipes, or looks wrong, check for these:
- No row of dashes. Without the second row, Markdown sees ordinary text. The dashes aren't decoration; they're what makes the table.
- Too few dashed cells. The dashed row needs a cell for every column in the header.
| Name | Role |followed by| --- |isn't a table. - Text straight after the table. A line typed directly below the last row, with no blank line between, becomes another row of the table. Leave a blank line after every table.
- Rows with the wrong number of cells. The header decides how many columns there are. A row with fewer cells gets empty ones at the end, and extra cells are dropped without a warning, so a value can quietly go missing.
- An unescaped pipe. A pipe in the text, as in Yes | No, starts a new cell.
Write
Yes \| No.
Tables are a common part of answers from ChatGPT, Claude and other AI assistants, and they come through intact when you copy the answer as Markdown. The AI answers to PDF page explains how to copy an answer with its formatting.
Other topics
- Math and LaTeX: formulas and equations
- Code blocks: code with syntax highlighting
- Footnotes: numbered notes and references
- Task lists: checklists with tick boxes
- Page breaks: controlling where pages end