OnlineTextLab
Esc

CSV to Markdown Table

Paste rows from a spreadsheet or a CSV file and get a Markdown table that lines up in the source and renders correctly.

The Markdown table appears here as you type.

Options
Column alignment
Layout

Lined-up columns read better in source. Compact gives smaller diffs.

Blank table

Runs on your device. Your files and text are not uploaded.

About CSV to Markdown Table

Writing a Markdown table by hand is tedious, and fixing the pipes after a single value changes is worse. Export your data as CSV, or copy cells straight from a spreadsheet, and this tool writes the table for you. Columns line up in the source, so the file stays readable in a code editor and in plain text diffs.

It suits the moment when data needs to go into documentation: benchmark results in a pull request, a feature comparison in a README, a schedule in a wiki. Numeric columns are right-aligned by default, so figures can be compared at a glance.

The Preview tab shows the rendered table, which is a quick way to confirm that the columns came through as you expected before pasting.

Two neighbouring jobs work from the same box. Paste a Markdown table whose columns have drifted and it comes back straight. Or insert an empty grid and fill it in by hand.

How it works

The first line with content decides the separator: whichever of comma, semicolon, tab or pipe appears most often. That is why cells copied directly from Excel or Google Sheets work too, as they arrive tab-separated. Quoted values are read properly, so a comma inside quotes stays in the cell, and "" becomes one quote mark.

Before anything is written, the tool checks for a double quote that never closes. A stray quote would otherwise merge every following row into one enormous cell without warning, so you get an error naming the line.

Each value then gets made safe for a table. A pipe becomes \|, a line break inside a quoted cell becomes <br>, which GitHub renders as a break, and rows with too few cells are filled out. With Numbers right selected, a column is right-aligned if every non-empty value looks like a number, allowing for thousands separators, a currency symbol or a percent sign. Line up columns then pads every cell to the width of its column.

When the second line of your input is a Markdown divider, the text is read as an existing table rather than as CSV. Its alignment markers stay, any column without one is checked for numbers, and the header setting does not apply.

How to use CSV to Markdown Table

  1. Paste CSV into the left pane, copy cells in from a spreadsheet, use Open file, or press Try an example.
  2. Check the table on the right, and open the Preview tab to see it rendered.
  3. Open Options to change Column alignment or Layout, or to turn off First row is the header.
  4. To start with nothing, set Columns and Rows in Options and press Insert blank table.
  5. Press Copy result, or Download .md.

A quoted comma, a pipe and a numeric column

Input
City,Population,Note
Oslo,709000,"Capital, Norway"
Bergen,289000,a|b
Output
| City   | Population | Note            |
| ------ | ---------: | --------------- |
| Oslo   |     709000 | Capital, Norway |
| Bergen |     289000 | a\|b            |

The population column was detected as numeric, which set the ---: divider. The comma in quotes stayed in its cell, and the pipe in the last row was escaped so it cannot start a new column.

When it helps

  • Adding benchmark results to a pull request description, with the numbers aligned for easy comparison.
  • Keeping a README comparison table current by regenerating it from a spreadsheet.
  • Pasting a shift schedule or price list from Google Sheets into a team wiki.
  • Documenting a database query result in a ticket, using a CSV export.

Tips for a better result

  • Use Compact layout if the table lives in Git and values change often. Padded columns mean one longer value rewrites every row in the diff.
  • If your data has no header row, turn off First row is the header. Markdown needs one, so the columns get the names Column 1, Column 2 and so on for you to replace.
  • Keep tables narrow. Past roughly six or seven columns, many sites make readers scroll sideways, so consider splitting it or linking to the full data.

Good to know

  • Markdown characters in your data are not escaped, apart from pipes. A value like *note* will render as italic, which can be wanted or not, so check the preview.
  • Line-up padding counts characters, so columns with Chinese, Japanese or Korean text or emoji may look uneven in the source. They still render correctly.
  • Merged cells and multiple header rows cannot be expressed in a Markdown table.
  • <br> for multi-line cells works on GitHub and most platforms, but some Markdown processors strip HTML and will show it as text or drop it.
  • If the first line has a more frequent character than the true separator, detection can pick wrongly. A title line above the data is the usual cause, so remove it.

Questions people ask

Can I paste directly from Excel or Google Sheets?

Yes. Selected cells are copied as tab-separated text, and the tab is detected automatically. There is no need to save a CSV file first, and the first row you selected becomes the header.

Why is one number column not right-aligned?

Every non-empty value in the column must look like a number. A single entry such as "n/a" or "12 kg" makes it a text column. Pick Right under Column alignment to force all columns, or edit the divider of that one column to "---:".

What does the error about an unclosed quote mean?

A cell starts with a double quote but no closing one follows, so everything after it would be swallowed into one cell. Close the quote, or double it ("") if it is a real character such as inches in 5" screen. The error names the line where the quote opened.

What to use next

Last reviewed . Read our editorial policy.