How to Convert an HTML Table to Markdown
To convert an HTML table to Markdown, paste the table into the box above. The tool reads the header and the rows and writes a pipe table with a header line, an alignment line and one line per row. For the first table in the Example it writes:
| Name | Role | Notes |
| :--------------------------------- | :--------------------- | :------------------------------- |
| Ada Lovelace | Mathematician | Wrote the first program, in 1843 |
| [Linus](https://example.com/linus) | **Engineer** | Pipes \| and more |
| Grace Hopper (admiral) | Grace Hopper (admiral) | Line one<br>Line two |The link in the second row stayed a link and the bold text stayed bold. The pipe in the Notes cell was escaped, because a bare pipe would start a new column. The line break in the last cell became a <br> tag, since a Markdown table row has to stay on one line.
Paste a Table Copied from a Web Page, Google Docs or Word
When you copy a table from a web page, Google Docs or Word, the clipboard holds an HTML version of it next to the plain text. The tool takes the HTML version when you paste, so the cells, the header and the links are all there. You do not need to look at the page source.
If the clipboard has only plain text with tabs between the cells, which is what a spreadsheet gives you, the tool reads that as a table as well. For a table that is already in CSV text, CSV to Markdown is the more direct tool.
What Is Kept and What Is Lost
Markdown tables are simpler than HTML tables, so some things have to change. The tool keeps the content and drops the layout.
- Kept: cell text, the header row, links, bold and italic text, line breaks (as <br>), special characters that Markdown would misread.
- Changed: merged cells. Markdown has no colspan or rowspan, so the value is repeated in each covered cell, or only the first cell is filled, depending on Merged cells.
- Replaced: an image becomes its alt text.
- Dropped: colors, widths, fonts, scripts, styles, and the caption. A table inside a cell is flattened into text, and a list inside a cell becomes words on one line.
Characters that Markdown uses for formatting, such as *, `, [ and ], are escaped with a backslash so they show as typed. An underscore is escaped only when it could start italics, so snake_case stays as it is. Turn off Keep links and bold if you want plain text without any Markdown marks.
How to Align Columns in a Markdown Table
The second line of a Markdown table sets the alignment with colons: a colon on the left means left, on both sides means center, and on the right means right. Align columns applies one choice to every column. Right alignment suits numbers, and left suits text.
Align columns in text is a separate setting. It pads each cell with spaces so the pipes line up in the raw text, as in the code above. That makes the Markdown easy to read and to compare in a pull request, and it does not change how the table is displayed. Turn it off for the shortest possible text.
Pipes and Line Breaks Inside Cells
Two characters cause most problems in Markdown tables. A pipe sign inside a cell would be read as the start of the next column, so the tool writes it as \|. A line break would end the row, so it is written as a <br> tag, which GitHub and many other renderers display as a line break.
Some places do not allow HTML tags. In that case set Line breaks in cells to Turn into a space, and the lines of a cell are joined with a space. If you want to clean text before you convert it, Remove HTML Tags strips tags from a block of text.
Markdown Tables in a README, Wiki or Issue
Tables are not part of the original Markdown. They come from extensions such as GitHub Flavored Markdown, which GitHub uses in READMEs, issues, pull requests and wikis. Many documentation tools and note apps support them too, but some renderers do not, so check where the text will be shown.
- A table needs a header row. If the HTML has none, turn on First row is the header, or turn it off to get an empty header row and keep every row as data.
- A wide table scrolls sideways on narrow screens in some renderers. Keep the columns few and the cell text short where you can.
- A very long table is easier to read when you split it into parts or link to the source.
- Check the preview of your platform before you publish. Rendering differences are the most common surprise.
Several Tables, Footnotes and Other Options
A page often holds more than one table. The Table menu lists each one with its number of rows and columns, and All tables writes them one after the other with an empty line between them. Remove [1] markers deletes references like [1], [a] and [citation needed], which show up in tables copied from encyclopedia pages.
If you need the same table as a spreadsheet file instead, use HTML Table to CSV. To write a simple list as one line, see Column to Comma Separated List.
Limits and Privacy
The tool cannot fetch a table from a web address, because a browser tool is not allowed to read other sites. It writes pipe tables only, not HTML tables, and it does not convert whole pages. It finds up to 200 tables in one paste and accepts up to 2,000,000 characters.
The conversion runs in your browser. The HTML is not sent to a server and not stored, and scripts in pasted HTML are never run. See the Privacy Policy for details. Respect the terms of the sites you copy data from.