CSV to Markdown Table

Turn CSV data into a clean Markdown or HTML table with column alignment and a live preview, handling quoted fields and pipes that would break the table.

Preview

One thing CSV can say that a markdown table cannot

Almost everything survives this conversion. Commas inside quoted fields, quotes inside quotes, ragged rows, empty cells — all fine. One thing does not, and it is a limit of the target format rather than a shortcut taken here:

A CSV field may contain a line break. A markdown table row may not.

A table row ends where the line ends. There is no escape, no continuation, no quoting — the format has nowhere to put a newline inside a cell. So a multi-line cell has to be flattened, and each line break becomes a space:

CellLinesBecomesRecoverable
"one line" 1 one line yes
"two\nlines" 2 two lines no
"three\nshort\nlines" 3 three short lines no

2 of 3, and worth saying plainly rather than hiding: for those cells the conversion is one-way. If your CSV has a notes or address column with line breaks in it, the table you get back is not the data you put in. Keep the CSV.

The loss really is that specific. Everything else about a cell comes through untouched:

CellBecomes
Compiler, pioneerCompiler, pioneer
she said "hello"she said "hello"
padded padded
cafécafé
100% sure100% sure
it's fineit's fine

The pipe is the one that would corrupt silently

A pipe inside a cell is a different kind of problem, and this page handles it by escaping to \|. Worth understanding what that prevents, because the failure it avoids does not look like an error — it looks like bad data.

The pipe is the column delimiter, so an unescaped one does not break the table. It adds a column. That row gains a cell, everything after it shifts, and nothing warns you:

Cell valueCells intendedUnescapedEscaped
plain 2 2 2
a|b 2 3 2
a|b|c 2 4 2

The damage scales with how many pipes the value happens to contain, which means a single unusual row can misalign a table that looked correct on every other row. Escaping restores the intended shape in each case.

A note on measuring this, because it caught the author out: counting cells by splitting a row on every pipe scores a correctly escaped cell as broken, and makes the escape look useless. A real parser splits on unescaped pipes only. The numbers above use that rule.

And the right-alignment guess errs generously

Markdown lets a column declare its alignment, and a column is right-aligned here when every value in it looks numeric. The test is a pattern: an optional minus, then digits, commas and dots, then an optional per cent sign.

ValueWhat it isTreated as numericActually a number
42 a whole number yes yes
-3.5 a negative decimal yes yes
1,200 a thousands separator yes yes
85% a percentage yes yes
2021 a year yes yes
1.2.3 a version number yes no
... an ellipsis yes no
,,, a run of commas yes no
. a bare dot yes no
1..2 a typo yes no
N/A a missing value no no
3 apples a quantity with a unit no no

It correctly catches 42, -3.5, 1,200 and 85%. It also catches 5 values that are not numbers under any reading — 1.2.3 ... ,,, . 1..2 — so a column of version numbers is right-aligned as though it were money.

The consequence is cosmetic, and the alternative is worse: tightening the pattern to real numbers would lose 1,200 and 85%, which are the cases people actually have. This is a reasonable place to be generous. The test is also per column rather than per cell — one non-numeric value anywhere in a column leaves the whole column left-aligned , which is why a single "unknown" undoes it.

How to use

  1. Paste your CSV data into the input box.
  2. Confirm the delimiter and whether the first row is a header.
  3. Choose the alignment for each column.
  4. Check the live preview to confirm the table renders as intended.
  5. Copy the Markdown or HTML table.

Frequently asked questions

Why does a pipe character break a Markdown table?

Because the pipe is the column separator. A pipe inside a cell's data splits that cell in two unless it is escaped with a backslash. It is by some distance the commonest cause of a Markdown table that renders with the wrong number of columns, and the failure is silent.

How does column alignment work?

Through colons in the separator row beneath the header — on the left for left alignment, on the right for right, and on both sides for centred. Numbers generally read better right-aligned so their digits line up by place value, and text left-aligned.

Do the columns need to line up in the source text?

No. Markdown does not care whether the pipes align in the raw source, though padding them makes the file far easier to read and edit by hand. The rendered output is identical either way, so it is purely a matter of how much you value tidy source.

Does every Markdown renderer support tables?

No. Tables are not part of the original Markdown or of the CommonMark core — they come from GitHub Flavored Markdown and similar extensions. Most modern renderers support them, but a strict CommonMark processor will output your pipes as literal text.

Can a Markdown table cell contain a line break?

Not directly, which is a real limitation for anything with substantial content in a cell. The usual workaround is an HTML break element inside the cell, which most renderers accept. For genuinely multi-line content, an HTML table is the better choice.

What if my CSV has no header row?

Markdown tables require one, so a header has to be invented — either generic column names or the first data row promoted into the role. There is no way to render a headerless Markdown table, though an HTML table can omit the header entirely.

What if my data contains commas?

Proper CSV handles this by quoting the field, and the parser here respects that. The problem only arises with data that was assembled by naive string joining rather than by a real CSV writer, in which case the column count will not match the header.

🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.