CSV to Markdown Table Converter
Turn CSV, a spreadsheet selection, JSON, XML or database console output into a Markdown table, with alignment, aligned pipes and a rendered preview.
Loading tool…
Parsing and formatting happen in your browser. Nothing you paste is uploaded or stored, so a spreadsheet of real data stays on your machine.
What the CSV to Markdown Table Converter does
This CSV to markdown table converter will turn CSV, a spreadsheet selection, JSON, XML or database console output into a Markdown table, with alignment, aligned pipes and a rendered preview. Everything runs inside this page, so the work happens on your own device rather than on a server. It is most often used for putting a spreadsheet of data into a README, a pull request or a wiki page. You may also want the query string parser.
How to use it
- Paste your data — CSV, a selection copied out of a spreadsheet, JSON, XML, or what a database console printed.
- The format is detected automatically; override it if the guess is wrong.
- Choose the output and, for Markdown, the column alignment.
- Check the rendered preview, then copy or download the result.
How it works
Most of the work is in reading the input, not writing the table. The formats people have in hand are all slightly hostile: a CSV field can contain a comma, a doubled quote or a line break inside its quotes, so splitting on commas is wrong on the first real file anyone tries. A selection copied out of Excel or Google Sheets is tab-separated, and its cells often contain commas. A JSON array from an API omits null fields, so taking the columns from the first record loses every column that happens to be absent from it. This reads each one properly: the CSV parser walks the text rather than splitting it, and JSON columns are the union of every record’s keys in the order they first appear.
Database console output is included because it is what you have when you have just run a query. MySQL draws +----+ rules around everything and pipes every row; psql uses one dashed rule with plus signs at the column joins, no outer pipes, and prints a "(2 rows)" footer that is not data. Both are recognised and both have their decoration stripped. An existing Markdown table is also a valid input, which is how you reformat one, change its alignment, or export it back to CSV.
On the output side, two characters would break a Markdown table and are escaped rather than left to corrupt the result. A pipe inside a cell silently adds a column, so it becomes \| — a row reading "Cable | 2 m" otherwise turns into two cells and knocks the whole table out of alignment. A line break ends the row entirely, so it becomes a <br>, which every renderer that supports tables also supports, since tables are themselves a Markdown extension rather than part of the original spec.
A Markdown table must have a header row. A table whose first line is data renders as literal text with visible pipes in most renderers, which is why the header checkbox synthesises "Column 1", "Column 2" rather than omitting the header when you turn it off. The alignment row is where left, centre and right come from: :--- , :---: and ---: respectively. Lining the pipes up changes nothing about how the table renders — it is purely for whoever reads the source next, and it makes a diff of a changed cell readable instead of reflowing the whole row.
Going the other way is often the more useful direction. Markdown or a pasted spreadsheet out to CSV gives you something a script can read; out to JSON gives an array of objects keyed by the header row. The JSON conversion is deliberately careful about numbers: a value with a leading zero is an identifier rather than a quantity, so a part number like 007, a phone number and a zip code keep their zeros instead of being quietly turned into integers. Everything that parses cleanly as a number becomes one; everything else stays a string.
When to use it
- Putting a spreadsheet of data into a README, a pull request or a wiki page.
- Turning a query result from a database console into something you can paste into a ticket.
- Converting a JSON API response into a readable table for documentation.
- Reformatting an existing Markdown table, or changing its column alignment.
- Exporting a Markdown table back out to CSV or JSON.
Common mistakes to avoid
- Splitting CSV on commas. A quoted field can contain commas, quotes and line breaks.
- Leaving a pipe unescaped in a cell, which silently adds a column and breaks the alignment.
- Publishing a Markdown table with no header row. It renders as literal text in most renderers.
- Taking JSON columns from the first record, which loses any field that record omits.
- Letting an identifier like 007 be converted to a number when exporting to JSON.
- Pasting database console output without stripping the +----+ rules and the row-count footer.
Frequently asked questions
How do I escape a pipe in a Markdown table?
Write it as \| . An unescaped pipe inside a cell is read as a column separator, so the row gains a column and the table stops lining up with its header. This tool escapes pipes automatically.
Can a Markdown table cell contain a line break?
Not literally — a newline ends the row. Use <br> instead, which every Markdown renderer that supports tables also supports. Cells containing line breaks are converted automatically and a note tells you when that has happened.
Does a Markdown table need a header row?
Yes. The header and the alignment row beneath it are both required by the syntax, and a table without them renders as plain text with visible pipes. If your data has no header, a generic one is generated rather than omitted.
Can it read what I copied out of Excel or Google Sheets?
Yes. A spreadsheet selection arrives as tab-separated text, which is detected automatically. That matters because spreadsheet cells frequently contain commas, and treating the paste as CSV would split them in the wrong places.
How do I set column alignment?
The alignment row controls it: :--- is left, :---: is centre, ---: is right, and plain --- leaves it to the renderer. Pick one from the alignment menu and it is applied to every column.
Will it convert a Markdown table back to CSV?
Yes. An existing Markdown table is a supported input, so you can read one in and write CSV, TSV or JSON out. Escaped pipes are unescaped on the way, so the round trip is lossless.