Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

HTML Table to CSV, TSV and JSON Converter

Extract tables from HTML into CSV, TSV or JSON.

The HTML is read in an isolated document: scripts never run and nothing is loaded.

About the HTML Table to CSV

Paste HTML and extract its tables to CSV, TSV or JSON. Handles thead and th headers, colspan and rowspan, several tables per page and messy whitespace.

How to use the HTML Table to CSV

  1. Copy the HTML of a page or table (for example with View source or Inspect, then Copy outer HTML) and paste it in.
  2. If the HTML has several tables, choose the one you want from the Table list.
  3. Pick CSV, TSV or JSON, and decide whether line breaks inside cells become spaces or new lines.
  4. Copy the result or download it. TSV pastes straight into spreadsheet cells.

Examples

A table with colspan and rowspan to CSV

Input

<table><caption>Team</caption><thead><tr><th>Name</th><th colspan="2">Contact</th></tr></thead><tbody><tr><td rowspan="2">Ada</td><td>[email protected]</td><td>Mon</td></tr><tr><td>London<br>UK</td><td>Tue</td></tr></tbody></table>

Output

Name,Contact,Contact
Ada,[email protected],Mon
Ada,London UK,Tue
To JSON with line breaks kept and scripts ignored

Input

<table><tr><th>Item</th><th>Price</th></tr><tr><td> Tea <script>alert(1)</script></td><td>&pound;2.50</td></tr><tr><td><p>Coffee</p><p>large</p></td><td>£3</td></tr></table>

Output

[
  {
    "Item": "Tea",
    "Price": "£2.50"
  },
  {
    "Item": "Coffee\nlarge",
    "Price": "£3"
  }
]

Frequently asked questions

How are colspan and rowspan handled?

The table is expanded into a full grid, so every row has the same number of columns. By default a merged cell's text is repeated in every slot it covers, which keeps rows meaningful when you sort or filter. Choose Leave empty to only fill the first slot.

Is it safe to paste HTML from any website?

Yes. The HTML is parsed into a separate document that is never added to this page, so scripts do not run, images do not load and styles do not apply. Only the text of the cells is read.

What happens to links, bold text and other formatting?

Only the visible text is kept. Tags such as links, bold and spans are removed, and script, style and template contents are skipped.

How does JSON output choose the keys?

With Use first row as keys ticked, the first row becomes the keys and each later row becomes an object. Empty headers become column_1 and so on, and repeated headers get a number. Untick it to get an array of arrays.

Can I fetch a table straight from a URL?

No. This tool never makes network requests. Open the page yourself, copy its HTML and paste it here, so the data stays on your device.