← All articles
Writing & Text

Markdown Table Syntax: Examples, Alignment and Common Mistakes

Markdown Table Syntax With Examples

To make a table in Markdown, write each row on its own line with cells separated by pipes (|), and put a separator row of dashes under the header: | Name | Price |, then |------|-------|, then | Tea | 3 |. Add colons to the separator to align columns: :--- left, :---: centre, ---: right. Tables are part of GitHub Flavored Markdown, so they work on GitHub, GitLab, Obsidian, Reddit and most modern editors.

Basic Markdown Table

| Day | Task        | Hours |
|-----|-------------|-------|
| Mon | Writing     | 2     |
| Tue | Client call | 1     |

The rules:

  • The first row is the header.
  • The second row must contain at least three dashes per column (---).
  • Pipes at the start and end of each line are optional, but they make the table easier to read.
  • Cells don’t have to line up in the source. Spacing is only for humans.

Aligning Columns

| Item   | Qty | Price |
|:-------|:---:|------:|
| Coffee |  2  |  4.50 |
| Bagel  |  1  |  3.25 |
Separator Alignment Typical use
:--- or --- Left (default) Text
:---: Centre Short codes, ticks, status
---: Right Numbers and prices, so decimals line up

What HTML Does It Produce?

A Markdown converter turns the table into standard HTML table tags. Alignment becomes an align attribute on each cell. Paste any table into the free Markdown to HTML converter to see the preview and copy the HTML:

<table>
<thead><tr><th align="left">Item</th><th align="center">Qty</th><th align="right">Price</th></tr></thead>
<tbody><tr><td align="left">Coffee</td><td align="center">2</td><td align="right">4.50</td></tr>
…
</tbody></table>

Formatting Inside Cells

You can use inline Markdown inside a cell: **bold**, *italic*, `code` and [links](https://example.com). Block elements such as lists, headings or multiple paragraphs can’t go inside a cell.

How to put a pipe character in a cell

Escape it with a backslash: \|. Without the backslash, Markdown treats it as a new column.

How to add a line break in a cell

Markdown has no line-break syntax inside table cells, but most converters accept the HTML tag <br>: | Line one<br>Line two |.

How to leave a cell empty

Just put nothing between the pipes: | Tea | | 3 |.

Common Mistakes

Problem Cause Fix
Table shows as plain text Missing separator row Add |---|---| under the header
Table shows as plain text No blank line before the table Leave an empty line above it
Columns shift Unescaped | inside a cell Use \|
Extra cells ignored A row has more cells than the header Match the header’s column count
Doesn’t render at all Platform uses strict CommonMark Use a GFM-compatible tool, or convert to HTML

Faster Ways to Make Markdown Tables

  • From a spreadsheet: many editors and online converters turn copied spreadsheet cells into Markdown tables. Check the output in a preview.
  • Editor plugins: VS Code and Obsidian have extensions that auto-align pipes as you type.
  • Keep it narrow: tables wider than about five or six columns are hard to read on phones. Split them, or use a list instead.

For other Markdown elements, see Markdown checkboxes and task lists.

Frequently Asked Questions

Do Markdown tables need a header row?

Yes. GitHub Flavored Markdown requires a header row followed by the dashed separator row. If you don’t want visible headers, some people leave the header cells empty, though this depends on the renderer.

Can I merge cells in a Markdown table?

No. Markdown tables don’t support merged cells (colspan or rowspan). Use an HTML table if you need them.

How many dashes do I need in the separator row?

At least three per column. More is fine and makes the source easier to read.

Why isn’t my Markdown table rendering?

Usually a missing separator row, no blank line above the table, or a platform that doesn’t support GFM tables.

Leave a Reply

Your email address will not be published. Required fields are marked *