Markdown tables: how to write and read them

A Markdown table is plain text that turns into a grid. You type words, pipes | and dashes -. A Markdown reader shows rows and columns.

Tables are everywhere in Markdown files: price lists, plans, comparisons, test results. AI chats and coding agents write them all the time.

The basic table

| Fruit  | Colour | Price |
|--------|--------|-------|
| Apple  | Red    | 1.20  |
| Banana | Yellow | 0.50  |

This is what it shows:

FruitColourPrice
AppleRed1.20
BananaYellow0.50

Three kinds of rows:

  1. Header row: the column names.
  2. Dashes row: separates the header from the rest. It is required. Without it, there is no table.
  3. Data rows: one line per row.

Pipes | separate the cells. The pipes at the start and end of each line are optional, but they make the table easier to read.

The columns don't have to line up in your text. This works too:

| Fruit | Colour | Price |
|---|---|---|
| Apple | Red | 1.20 |

Leave an empty line before and after the table. The table ends at the first empty line.

Aligning columns

Add colons : to the dashes row:

| Left | Centre | Right |
|:-----|:------:|------:|
| a    | b      | 1.20  |
| aa   | bb     | 10.50 |
LeftCentreRight
ab1.20
aabb10.50

Formatting inside a cell

Cells can hold bold, italics, code and links:

| Task      | Status   | Link                         |
|-----------|----------|------------------------------|
| Write     | **Done** | [Notes](https://example.com) |
| `npm test`| *Running*|                              |

To put a pipe inside a cell, write it as \|. Otherwise it starts a new cell. This also applies inside code.

What tables can't do

Wide tables

A table with many columns gets wide, especially on a phone. Some tips:

Quick ways to make a table

Reading Markdown tables

In a plain text editor, a table stays as pipes and dashes. That is readable for small tables, but hard for big ones. A Markdown reader shows the real grid.

PilcrowMD shows Markdown tables on Android and Mac. Cells can show bold, italics, links and maths. On Android, a wide table scrolls sideways, so the columns don't get squeezed.

Common questions

Is a Markdown table the same everywhere? Mostly. Tables are part of GitHub Flavored Markdown, which most apps follow. A few very simple Markdown apps don't show tables at all.

Can I add a line break inside a cell? Not in standard Markdown. Some apps accept the HTML tag <br>, but not all.

Do I need to line up the pipes? No. It only makes the text easier to read.

Also on Mac: PilcrowMD for Mac (beta)