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.

Markdown
Preview

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:

| 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:

  1. 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.
  2. Drop or move columns. Notes and descriptions can go in a list after the table, keyed by the first column.
  3. Turn it on its side. A table comparing three products on ten features is wider with products as rows than with features as rows.
  4. 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.

StyleTables look likeGood for
ClassicLines above, below and under the header only, small capitals in the header, centered on the pageEssays, letters and anything book-like
AcademicThree horizontal lines in the style of a journal, in slightly smaller type, centeredPapers and lecture notes
ModernFull width, a thin line between rows and a small grey header in capitalsProposals, guides and handouts
ReportFull width with a complete grid, a shaded header and sans-serif figuresBusiness and technical reports with lots of numbers
RésuméCompact, with a single line under the header and no other bordersSkills or certifications laid out in columns
WorksheetFull width in a rounded box in the accent color, with dotted lines between rows and columnsWord lists, schedules and fill-in charts
GitHubA grid with every other row shaded, as on github.comTechnical documentation and READMEs
GothicOxblood lines above, below and under the header, small capitals in the header, centered on the pageStories and game handouts that should look old
SandwakeHeavy lines above and below, spaced typewriter capitals in the header, at the left of the pageShip rosters, star charts and other science-fiction handouts
ElvishFull width between double green lines, with spaced gold capitals in the headerInvitations, lore and story notes
CyberpunkFull width in a frame, with a shaded header in teal typewriter capitalsGame handouts and mission briefings
NewspaperFull width, a heavy line above, light lines between rows and spaced capitals in the headerTimetables, results and notices
FiendishFull width between heavy lines, with thin lines between rows and vermilion capitals in the headerTerms, 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:

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

Back to the Markdown guide