Markdown table alignment: it's the separator line, not spaces

PublishedToolMarkdown Table Generator

Contents
  1. The second line that tells Markdown it's a table
  2. Where you put the colon decides the alignment
  3. What happens when the separator line is malformed
  4. How the tool handles this syntax for you
  5. Recap
  6. Frequently Asked Questions

If you've ever written a Markdown table by hand and tried to center text by hammering the spacebar, you know it doesn't work. Alignment in a Markdown table isn't controlled by spacing at all. It comes from somewhere else entirely.

Summary ① Alignment in a Markdown table is set by the position of the colon (:) in the separator line directly under the header — not by spaces inside the cell. ② :--- means left, :---: means center, and ---: means right. That's the convention. ③ If that separator line is missing or malformed, text that looks like a table won't be recognized as one. It just shows up as plain characters.

The second line that tells Markdown it's a table

A Markdown table takes at least two lines. The first line is the header row, with each cell separated by a pipe (|). The line right below it is a separator made only of hyphens (-). That separator is what tells the Markdown renderer "this is a table," and it treats the line above it as the header.

The catch is that this separator also carries the alignment information. It looks like nothing more than a row of hyphens, but whether a colon sits before or after them completely changes how that column is aligned.

Where you put the colon decides the alignment

The position of the colon in the separator line sets one of three alignments. :--- with a colon only on the left is left-aligned, :---: with colons on both sides is centered, and ---: with a colon only on the right is right-aligned. Plain --- with no colon follows the renderer's default, which is usually left.

No amount of spaces inside a cell will push text toward the center in the rendered output. The renderer ignores leading and trailing spaces in cells and calculates alignment from the colon positions in the separator line alone.

Markdown Table Generator

A Markdown table generator that builds the exact table syntax as soon as you set rows, columns, and alignment

What happens when the separator line is malformed

If the number of cells in the separator line doesn't match the header row, or if it contains something other than hyphens, the Markdown renderer may fail to see the whole block as a table. When that happens, the pipes and hyphens you used to fake a table show up as literal characters, leaving you with a hard-to-read string of symbols instead of the table you wanted.

How the tool handles this syntax for you

With Markdown Table Generator, you set the number of rows and columns and type content into each cell, and it assembles the header row, the separator with alignment built in, and the body rows into correct syntax automatically. You can pick left, center, or right alignment for each column, and the colons in the separator update in real time the moment you choose. If you put characters that clash with table syntax into a cell, like a pipe (|) or a line break, they're escaped automatically so the table doesn't break.

Recap

  • Alignment in a Markdown table is set by the colon positions in the separator line under the header, not by spaces inside cells.
  • Three notations — :--- (left), :---: (center), ---: (right) — let you align each column differently.
  • If the separator's cell count doesn't match the header row or its format is off, the whole table may not be recognized.
  • Pipes (|) or line breaks inside a cell conflict with table syntax, so they need to be escaped.
  • Markdown Table Generator handles alignment choices and special-character escaping for you, so you get a table with correct syntax.
Markdown Table Generator

A Markdown table generator that builds the exact table syntax as soon as you set rows, columns, and alignment

Frequently Asked Questions

Can I center text in a cell by pushing it over with spaces?

No. The Markdown renderer ignores leading and trailing spaces in cells and calculates alignment only from the colon positions in the separator line. If you want centered text, the separator has to be written as :---:.

What happens if I don't specify alignment?

If the separator has only hyphens and no colons (---), no alignment is set, and the renderer falls back to its default alignment, which is usually left.

I added pipes to make it look like a table, but it doesn't render as one. Why?

The most common causes are a missing hyphen separator directly under the header row, or a separator with a different number of cells than the header. Without the separator, the renderer won't recognize a table and will display your pipes and text as plain text.

How do I put a pipe (|) character inside a cell?

A pipe is the syntax that separates columns, so dropping one in as-is can be read as starting a new cell. This tool automatically escapes pipes you type into a cell so the table stays intact.

This article was adapted from our Korean original. Read the Korean original

Related articles

  1. Convert Markdown Table to CSV for Excel Without Broken RowsCopy a Notion or GitHub Markdown table into Excel and it collapses into one column. Here's why it breaks, and how to get clean CSV with no divider row.
  2. How to Write Meeting Minutes That Track Action ItemsLearn meeting minutes that still help two weeks later: keep agendas and decisions separate, and give every action item an owner and a due date.
  3. Press Release 5W1H: Headline and Lead Paragraph OrderLearn how to place the 5W1H in your press release headline and lead paragraph, plus the one headline mistake that gets your release skipped.
  4. Proposal Outline Order: Why It Changes by Project TypeWhy proposal outlines aren't free-form, the standard structure for each project type, and what to check when the client's RFP sets its own outline.
  5. SQL INSERT to CSV: Keep NULL and Empty Strings ApartConvert SQL INSERT statements to CSV without losing the difference between NULL and empty strings, and check the export keeps them apart.
  6. vCard (.vcf) Files: Why Contacts Work Across AppsLearn why vCard (.vcf) files open in any contacts app, and why a name with a semicolon, comma, or line break needs escaping before you save it.

Related tools