Xerobit

Markdown Table Generator: Convert CSV to GFM Tables

Paste comma-separated or tab-separated values and this markdown table generator converts them into a properly formatted GitHub Flavored Markdown table. It handles quoted fields, escapes pipe characters, pads ragged rows, and lets you pick column alignment. Everything runs locally in your browser so no data is uploaded anywhere.

Paste your delimited text here. Quoted fields with commas, quotes or line breaks are supported.

Adds spaces and dashes so columns line up visually in plain text.

Markdown Table

| Name  | Age  | City     |
| :---- | :--- | :------- |
| Alice | 30   | New York |
| Bob   | 25   | London   |

How to use the markdown table generator

  1. Paste your CSV or TSV data into the text area.
  2. Select the delimiter or leave it on Auto-detect.
  3. Choose your preferred column alignment: left, center, or right.
  4. Toggle whether the first row should be treated as a header.
  5. Copy the generated GitHub Flavored Markdown table from the output.

How the markdown table syntax works

GitHub Flavored Markdown (GFM) represents tables using pipes (|) to separate cells and hyphens (-) to draw the header separator. A basic table looks like this:

| Header 1 | Header 2 |
| --- | --- |
| Cell 1 | Cell 2 |

The separator row controls alignment. Left alignment uses :---, center uses :---:, and right uses ---:. If no colon is present, the default rendering is typically left-aligned. This markdown table generator builds that structure automatically from your raw delimited text.

Parsing CSV correctly

Converting CSV to markdown requires more than splitting on commas. Fields can be wrapped in double quotes to contain commas, newlines, or literal quote characters. The standard rule (RFC 4180) is that a double quote inside a quoted field is escaped by doubling it: "She said ""hello""" becomes She said "hello".

This tool implements a state-machine parser that tracks whether it is inside a quoted field. When auto-detecting the delimiter, it counts commas, tabs and semicolons in the first line (ignoring any inside quotes) and picks the most frequent one. A line break inside a quoted field is kept as a <br> tag, because a Markdown table row has to stay on one line. Once parsed, any literal pipe character (|) inside a cell is escaped to \| so it does not break the markdown table structure.

Handling ragged rows

Real-world data often has rows with fewer columns than the header. If your first row has five columns but the second row only has three, the resulting markdown will be malformed unless the missing cells are filled. This markdown table converter scans all rows to find the maximum column count, then pads shorter rows with empty strings.

For example, inputting A,B,C\n1\n4,5 produces a valid table where the missing cells are simply blank between the pipes. Padding ensures every row has exactly the same number of delimiters, which is required by GFM parsers to render the table correctly.

Common conversion workflows

Developers frequently need to turn spreadsheet exports into documentation. A typical workflow involves exporting a database query or spreadsheet as CSV, pasting it into this tool, and copying the output directly into a README.md file or wiki page.

  • Documentation: Embed API parameter lists or configuration options as readable tables in Markdown files.
  • Data migration: If you need to move data further, you can chain tools. For instance, use the CSV to JSON converter for programmatic use, or the CSV to SQL tool to generate insert statements.
  • Issue tracking: Paste structured bug reports or test matrices into GitHub issues, which natively support GFM tables.

Alignment reference

Here is a quick reference for how the separator row changes based on your alignment choice:

AlignmentSeparator syntaxExample output
Left:---| :--- |
Center:---:| :---: |
Right---:| ---: |
Default---| --- |

When column padding is enabled, the tool calculates the widest cell in each column, adds spaces to narrower cells and stretches the dashes in the separator row to match. Widths are counted in characters, so wide characters such as emoji or CJK text may look slightly off in a monospaced editor. Without a header row, an empty header is added because GFM requires one. This makes the raw markdown easier to read in a text editor, though it does not change how the table renders on platforms like GitHub.

Worked examples

ExampleInputResult
Simple two-column tableCSV or TSV data: a,b / 1,2; Delimiter: comma; Column alignment: left; First row is header: yes; Pad columns for alignment: yes| a | b | / | :--- | :--- | / | 1 | 2 |
Center-aligned with quotesCSV or TSV data: "x,y",z / 1,2; Delimiter: comma; Column alignment: center; First row is header: yes; Pad columns for alignment: yes| x,y | z | / | :---: | :---: | / | 1 | 2 |
Ragged rows paddedCSV or TSV data: A,B,C / 1 / 4,5; Delimiter: comma; Column alignment: left; First row is header: yes; Pad columns for alignment: yes| A | B | C | / | :--- | :--- | :--- | / | 1 | | | / | 4 | 5 | |
No header rowCSV or TSV data: 1,2,3 / 4,5,6; Delimiter: comma; Column alignment: none; First row is header: no; Pad columns for alignment: no| | | | / | --- | --- | --- | / | 1 | 2 | 3 | / | 4 | 5 | 6 |

FAQ

Does this tool upload my data to a server?

No. The entire conversion happens locally in your browser using JavaScript. Your CSV or TSV data never leaves your device.

Can I paste data directly from Excel?

Yes. When you copy cells from Excel, they are separated by tabs. Set the delimiter to Tab or leave it on Auto-detect, and the tool will parse it correctly.

What happens if my data contains pipe characters?

Any pipe character inside a cell is automatically escaped with a backslash so it does not interfere with the markdown table syntax.

Why are some rows longer than others in my output?

If your input has ragged rows, the tool finds the maximum number of columns across all rows and pads the shorter ones with empty cells to ensure valid GFM syntax.

What is the difference between padded and unpadded columns?

Padding adds extra spaces inside cells so the pipes align vertically in plain text. Unpadded output uses the minimum necessary spaces, which results in a smaller file size.

Can I use this to convert a table back to CSV?

No. This tool only converts delimited text into Markdown. To go from a Markdown table back to CSV you would need a separate parser that reads GFM syntax.