How to Convert CSV to a Markdown Table (Columns, Pipes and Alignment)
Pasting a table into Markdown is mostly the tedium of drawing the separator row and the pipes. Paste the data, convert once, and the table source is ready to commit.
Open the tool:CSV to Markdown Table
When a Markdown table is what you need
A reproduction-steps table in an issue, a parameter comparison in a README, a change list in a pull request description: a table reads better than a list. But copied from Excel it arrives as tab-separated text, and adding pipes by hand is slow and easy to misalign.
Documentation, wikis and blog posts raise the same task — take existing tabular data and turn it into Markdown syntax instead of retyping it.
- Parameter and comparison tables in a README
- Reproduction steps in issues and pull requests
- Data tables in docs, wikis and blog posts
- Turning spreadsheet content into committable text
The rules, and three things to watch
Rows are processed one at a time, blank lines are dropped, and each row splits on tabs or commas. The first row becomes the header, every later row becomes a table row, and the separator row is always three hyphens. The first row of your data must therefore be column names.
Three things to watch. A pipe inside a cell breaks the table structure and has to be replaced or escaped first. Rows with different column counts are not padded, so the short row simply has fewer cells. A line break inside a cell misaligns the parse, so flatten the content to one line first.
- The first row must be the header
- Both commas and tabs work as separators
- Commas inside quotes stay together, but the quotes remain
- Pipes inside cells break the table
- Ragged rows are not padded
Alignment, column widths and the limits
The generated separator is three hyphens, which means default alignment. Markdown supports colons instead: a leading colon is left, colons on both sides centre, and a trailing colon is right. This tool does not emit those, so edit the separator row afterwards.
Column widths need no attention: ragged columns in the source render evenly, so padding with spaces only helps the raw text. Merged cells, grouped headers and multi-line cells are not supported either; those tables need HTML or have to be split up.
- No alignment by default — add colons by hand
- Uneven column widths do not affect rendering
- No merged cells or multi-line cells
- Use an HTML table for complex layouts
FAQ
Can the table be centred or right-aligned?
The tool emits no alignment markers, but Markdown supports them: a leading colon makes a column left-aligned, colons on both sides centre it, and a trailing colon right-aligns it. Edit the separator row after converting, and most renderers will honour it.
What if a cell contains a pipe character?
A pipe is the column separator, so an unescaped one makes the rest of the cell look like new columns. Escape it with a backslash, replace it with an HTML entity, or swap it for a slash or comma before converting.
Excel copies tab-separated text — does that work?
Yes. Both tabs and commas are accepted, so copying straight from Excel or another spreadsheet usually works without exporting a CSV first. Remember that the first row becomes the header, so include the column names when copying.
Related tool:CSV to Markdown Table