How to Convert an HTML Table to Markdown (Copy Tables from Any Website)

Published · By Sh23

You found a table on a web page and want it in ChatGPT, Claude, Notion or a GitHub README. A plain copy and paste usually turns it into a run of words with no columns. Converting the HTML table to a Markdown table keeps the rows and columns. This guide covers the Markdown table syntax, three ways to convert a table, and how to fix the parts that usually break: merged cells, two-row headers and footnote marks. The syntax rules are checked against GitHub's documentation and the GitHub Flavored Markdown spec.

Markdown table syntax in 30 seconds

A Markdown table separates columns with | (pipes) and puts a row of --- under the header row. Here is a made-up example:

| Item | Price | In stock |
| :--- | ---: | :---: |
| Folding umbrella | $20.00 | Yes |
| Long umbrella | $15.00 | No |
| Raincoat | $38.00 | Yes |

Colons in the second row set alignment: :--- is left, ---: is right and :---: is centered. Right-aligning number columns such as prices makes them easier to compare.

According to GitHub's guide Organizing information with tables, each column of the header row needs at least three hyphens, the pipes at either end of a row are optional, and cells don't have to line up.

Rules that trip people up

Three ways to convert an HTML table to Markdown

1. Go through a spreadsheet (no tools to install)

  1. Copy the table from the web page and paste it into Excel or Google Sheets. Delete the rows and columns you don't need.
  2. Select the cells, copy them, and paste into a plain-text editor. In most cases the columns come out separated by tabs.
  3. Use the editor's find and replace to change each tab to | , then add | at the start and end of each line.
  4. Add a row such as | --- | --- | --- | under the first line, with one --- per column.

This works well for small, simple tables. It gets tedious once the table has dozens of rows or merged cells.

2. Convert the HTML with Pandoc

If you are comfortable with the command line, right-click the table, choose "Inspect," copy the <table> element's HTML into a file, and convert it with Pandoc:

pandoc -f html -t gfm table.html -o table.md

Simple tables become pipe tables. Tables that pipe tables cannot express, such as ones with merged cells, may come out as raw HTML instead, so check the result.

3. Use a browser extension

If you copy tables often, an extension saves the most time. Several can do it; the next section uses SumiTable, the one we make, as the example.

Why merged cells, two-row headers and footnotes break

An HTML table can join cells across rows or columns (merged cells, rowspan and colspan) and can have a header that spans two rows. A Markdown table is just one header row followed by data rows, with no way to merge cells. Copy the layout as is and the columns shift.

Copy any table as Markdown with SumiTable

SumiTable is a free browser extension by Sh23 (store release in preparation) that does the fixes above for you before it builds the Markdown table.

  1. On a page with a table, click SumiTable in the toolbar.
  2. The tables on the page are listed with their title and number of rows and columns. Pick one and it is outlined on the page.
  3. Click "Markdown" to copy it.

You can also select some text inside a table, right-click, and choose "Copy this table as Markdown."

Merged cells are expanded and the value is repeated in every covered cell (you can turn this off in the settings). Multi-row headers are combined into one line, like 2025 / H1. Footnote marks such as [1] are removed, and so are empty rows and columns. A | inside a cell becomes \|, and a line break inside a cell becomes <br>. Here is what the output looks like for a small table with a footnote mark and a pipe in a cell:

| Item | Price |
| --- | --- |
| A | $1,200 |
| B\|x | (42) |

The free version works now, up to 200 rows per table. The conversion runs on your computer, and the page content is not sent anywhere.

Removing the row limit and exporting every table on a page at once are planned for a future paid version (Pro). Pro is not on sale yet. See About SumiTable for details.

If you want the whole page as Markdown, headings and body text included, use our companion extension SumiClip. Tables inside the article come out as Markdown tables too (how to copy a web page as Markdown).

Why Markdown tables work well for AI chats

Summary

Related