Boneyard Tools

Markdown table syntax and alignment explained

How a GitHub-flavored Markdown table is built from pipes and dashes, how the colon markers set alignment, and how to escape tricky characters.

The three parts of a Markdown table

A Markdown table is plain text made of three blocks. The first line is the header row, with each column wrapped in pipe characters. The second line is the separator, a row of dashes that tells the renderer this is a table and carries the alignment. Every line after that is a data row using the same pipe pattern. This converter builds all three from your CSV, padding short rows so the pipe counts always match.

How alignment works

Alignment lives entirely in the separator row, not in the header. Plain dashes such as three hyphens mean left aligned, a leading and trailing colon means centered, and a trailing colon alone means right aligned. Numbers usually read best right aligned so the digits line up, while labels are clearer on the left. Because the setting is per column in real Markdown but applied to the whole table here, pick the alignment that suits most of your columns.

Escaping characters that break the grid

The pipe character is special in a table because it separates columns, so any literal pipe in your data must be escaped as a backslash pipe or the row will gain phantom columns. This tool does that automatically, and it escapes backslashes first so a value that already contains one stays intact. It also flattens hard line breaks inside a cell into a single space, since a table cell cannot span multiple lines.

When a Markdown table is the right choice

Markdown tables shine for small, readable grids in documentation, pull request descriptions, changelogs and wikis where you want the source to stay legible. They are not a data format, so for anything you need to parse again later a CSV or JSON file is a better fit. If a table grows very wide it can become hard to edit by hand, which is exactly why generating it from CSV saves time.

Frequently asked questions

Do Markdown tables need a header row?

GitHub-flavored Markdown requires a header line and a separator line for the table to render at all. If your data has no real header, uncheck the header option so the tool supplies Column 1, Column 2 and keeps the table valid.

Why do my table pipes show as plain text?

The viewer you are using probably does not support the tables extension. Basic CommonMark has no tables, so try a GitHub-flavored Markdown renderer or a tool that enables the tables plugin.

Can each column have its own alignment?

Native Markdown allows a different marker per column, but this converter applies one alignment to the whole table. To vary it per column, generate the table then edit the colons in the separator row by hand.