Skip to content

Table Converter and Generator

Edit a table in a grid and take it out as CSV, Markdown, LaTeX, HTML or JSON. Everything is worked out in the page.

Nothing you paste is uploaded. Reading, editing and writing all happen in this page, and the output changes as you type.

Row
markdown
| Player       | Home runs | Average |
| ------------ | --------- | ------- |
| Mark McGwire | 70        | 0.299   |
| Sammy Sosa   | 66        | 0.308   |
| Barry Bonds  | 73        | 0.328   |

3 rows of 3 columns.

What Markdown carries

The GitHub Flavored Markdown tables extension. The delimiter row carries the alignment through the colons, and a pipe inside a cell is escaped. A line break inside a cell has nowhere to go in this format, so it becomes a space.

A table is one of the few things every format writes down differently and nobody wants to retype. This page reads a table in any of five notations, lets you edit it in a grid, and writes it back out in any of the five. Each notation is written the way its own specification says: RFC 4180 for CSV, the GitHub Flavored Markdown tables extension for Markdown, a tabular environment for LaTeX, and a table element with a thead and header cells for HTML. What survives the trip and what does not is written next to each format rather than left for you to discover, because a table that quietly loses its alignment is worse than one that says it will.

How it is calculated

| left | right | centre | | :--- | ----: | :----: |

Only Markdown and LaTeX carry the alignment of a column. In Markdown it rides in the delimiter row: cells of hyphens with a leading colon for left, a trailing colon for right, or both for centre. In LaTeX it is one letter per column in the specifier after \begin{tabular} — l, c or r. CSV, JSON and HTML have nowhere to put it as written here, so going out through one of those and coming back leaves every column left-aligned.

Source: GitHub Flavored Markdown, Tables (extension) — "The delimiter row consists of cells whose only content are hyphens (-), and optionally, a leading or trailing colon (:), or both, to indicate left, right, or center alignment respectively", and "The header row must match the delimiter row in the number of cells. If not, a table will not be recognized."

Questions people ask

What happens to a comma or a quote inside a CSV cell?
The field is wrapped in double quotes, and a quote inside it is doubled. That is what RFC 4180 asks for, and it is also how the reader here understands a field coming in, so a value like say "hi" survives a round trip unchanged.
Why did my table lose its alignment?
Because it went through a format that has no way to write it down. Markdown keeps alignment in the delimiter row and LaTeX in the column specifier; CSV, JSON and the HTML written here do not carry it. The grid still holds the alignment, so switching the output format back brings it with you.
What if a row has the wrong number of cells?
It is squared off against the header. That is the Markdown rule as well: a short row has empty cells inserted, and anything past the width of the header row is ignored. A Markdown table whose header and delimiter rows disagree, on the other hand, is not a table at all, and this page says so instead of guessing.
Can it read any HTML table?
Only a plain one. Rows and cells are picked out of the markup, so a table shaped like the one this page writes reads back cleanly. Cells spanning several rows or columns, nested tables and cells holding block markup are beyond it — the value would arrive in the wrong box, so it is better not to promise it.
Why is every value in the JSON output a string?
Because a table cell has no type. Guessing that 0.299 is a number and 007 is not would change some of your data and not the rest, and the guess would be invisible in the result. Keeping every value as text means what comes out is what went in.
Does anything get uploaded?
No. Reading, editing and writing all happen in this page, so a table of names or prices can be pasted here the same way as a table of sports statistics.

Sources

The documents this page reads its numbers out of, linked so you can check them yourself.

  1. GitHub Flavored Markdown, Tables (extension) — "The delimiter row consists of cells whose only content are hyphens (-), and optionally, a leading or trailing colon (:), or both, to indicate left, right, or center alignment respectively", and "The header row must match the delimiter row in the number of cells. If not, a table will not be recognized."
  2. RFC 4180 section 2 — "Within the header and each record, there may be one or more fields, separated by commas", "Fields containing line breaks (CRLF), double quotes, and commas should be enclosed in double-quotes", and "a double-quote appearing inside a field must be escaped by preceding it with another double quote"
  3. LaTeX2e: An unofficial reference manual, tabular — the synopsis is \begin{tabular}[pos]{cols} with rows written "column 1 entry &column 2 entry ... &column n entry \\", the column specifiers l, c and r giving "a column of left-aligned items", "of centered items" and "of right-aligned items", | giving "a vertical line the full height and depth of the environment", and \hline putting "a horizontal rule below a row"
  4. HTML Living Standard, tabular data — "The table element represents data with more than one dimension, in the form of a table", "The thead element represents the block of rows that consist of the column labels (headers)", "The th element represents a header cell in a table", and the scope attribute is "an enumerated attribute with the following keywords and states: row, col, rowgroup, colgroup"

Related tools

Found a problem, or want more?

A number that disagrees with its source is a defect, not a rounding preference.

What did you enter, what did the tool show, and what did you expect instead? If you have a source that disagrees with ours, a link to it is the most useful thing you can send.

Write to us

Opens your mail app with the page and tool already filled in.