Skip to content

CSV to Markdown Table

Convert CSV (or TSV — auto-detected) to a Markdown table.

This tool converts CSV to a Markdown-flavored table. The conversion runs in your browser; nothing leaves your machine. For pasting tabular data into READMEs, GitHub issues, blog posts, or any Markdown-rendered surface.

What a Markdown table looks like

| name  | age | city     |
|-------|-----|----------|
| Alice | 30  | New York |
| Bob   | 25  | Boston   |

Three structural rules:

  1. Pipes (|) separate cells, with optional pipes at the start and end of each row.
  2. The second row is the separator, made of dashes. Its presence is what tells the renderer “this is a table.” Without it, the lines render as plain text with literal pipes.
  3. Column count must match. Header row, separator row, and each data row should have the same number of cells. Renderers tolerate mismatches differently — GitHub’s renderer pads or truncates; some renderers refuse the table entirely.

Column alignment

The separator row encodes alignment with colons:

| left  | center | right  |
|:------|:------:|-------:|
| a     | b      | c      |
| longer| longer | longer |
SeparatorAlignment
------ or :------Left (default)
:------:Center
------:Right

The dashes can be any length ≥ 3. The colons indicate alignment.

What the tool above produces

The CSV is parsed (using the same logic as CSV to JSON), and the result is emitted as a Markdown table:

  • Header row is the first CSV row.
  • Separator row is auto-generated (---, which renders left-aligned; add colons by hand for other alignments).
  • Data rows are CSV rows, one per line, in the compact form (cells are not padded).
  • A tab-separated first line switches the delimiter to tab automatically.
Input CSV:
name,price,stock
Widget,9.99,142
Gizmo,14.50,38

Output Markdown:
| name | price | stock |
| --- | --- | --- |
| Widget | 9.99 | 142 |
| Gizmo | 14.50 | 38 |

Markdown renderers ignore extra whitespace inside cells, so this renders exactly like a hand-aligned table. If you’ll edit the table by hand, an editor extension or prettier can pad the columns for you.

Cell content edge cases

  • Pipes inside cells. A literal | character inside a cell breaks the table parser. Escape it as \|. The tool above does this automatically.
  • Newlines inside cells. Markdown tables don’t natively support multi-line cells. The tool above replaces a newline inside a quoted CSV cell with <br>, which most Markdown renderers honor.
  • Markdown formatting inside cells. Bold, italic, code, and links work inside cells: | **bold** | *italic* | `code` | [link](url) |. The tool above passes through any Markdown syntax in the source CSV.
  • HTML inside cells. GitHub-flavored Markdown allows raw HTML; some other renderers don’t. Be portable when in doubt.

Where Markdown tables work and don’t

RendererTables supported
GitHub Flavored MarkdownYes (full)
GitLabYes
CommonMark (strict)No — tables are an extension
MDXYes (most setups)
Slack messagesNo (rendered as raw text)
Discord messagesNo
Most static-site generators (Jekyll, Hugo, Eleventy)Yes
ChatGPT / Claude / most AI chatYes

If you’re targeting “any Markdown renderer,” tables aren’t safe. For GitHub-or-similar, they’re the standard.

When a Markdown table isn’t the right fit

  • Tables with merged cells. Markdown tables don’t support colspan or rowspan. Use HTML if the renderer allows, or rethink the table.
  • Tables with very wide content. Markdown tables don’t wrap; a 200-char cell makes the entire table impossibly wide. Use a list or split into multiple smaller tables.
  • Tables with complex formatting per cell. Markdown’s per-cell formatting is limited; for rich content, use a dedicated table component (in MDX/Astro/etc.) or HTML.
  • Tables that need sorting or filtering. Markdown is static. For interactive tables, a JavaScript table library is the answer.

Padding the table for readability

Two equivalent Markdown tables:

Compact (renderer-friendly, hard to read):
|name|age|city|
|---|---|---|
|Alice|30|NYC|

Padded (renderer-friendly, easy to read):
| name  | age | city |
| ----- | --- | ---- |
| Alice | 30  | NYC  |

Both render identically in any compliant renderer. The padded form is much easier to edit by hand — you can scan column boundaries visually. The tool above produces the compact form.

Common pitfalls

  • Forgetting the separator row. Without |---|---|, the lines render as plain text. The most common Markdown table mistake.
  • Inconsistent column counts. Header has 3 columns, data has 4. Most renderers handle gracefully but the result is often surprising. Validate after generation.
  • Using \n inside cells. Renderers don’t honor it. Use <br> if multi-line is essential.
  • Pasting tab-indented CSV. A “CSV” file that’s actually TSV won’t parse correctly with comma as the delimiter. Set the delimiter explicitly. See also CSV to TSV.
  • Wide enough that the source is unreadable. A 12-column Markdown table with each cell 30 chars wide is essentially unreadable in raw form. Consider whether HTML or a dedicated table component is better.

For other Markdown-table generators, see JSON to Markdown table. For CSV-to-other-formats, CSV to JSON, CSV to TSV.