HTML to CSV Converter - Extract Table Data Online Free

Convert HTML tables to CSV instantly in your browser. Paste any HTML, get a clean CSV for Excel or Google Sheets. Free, no signup, data stays private.

HTML
175 chars · 5 lines · 175 bytes
CSV
DOMParser is not defined

Turn Any HTML Table into a Clean CSV in Seconds

Paste your HTML and this tool instantly pulls out every table row and column, giving you a clean, comma-separated file you can open in Excel, Google Sheets, or any data tool. No formulas, no manual copy-pasting, no reformatting headaches.

Quick snippet-bait: Converting HTML tables to CSV is exactly as mechanical as it sounds — here is the same tiny table in both formats side by side.

Input HTML:

<table>
  <tr><th>Product</th><th>Price</th><th>Stock</th></tr>
  <tr><td>Widget A</td><td>9.99</td><td>120</td></tr>
  <tr><td>Widget B</td><td>14.50</td><td>45</td></tr>
</table>

Output CSV:

Product,Price,Stock
Widget A,9.99,120
Widget B,14.50,45

Paste your HTML table above, then copy or download the result. The tool automatically detects numbers (so 9.99 stays a number, not "9.99") and handles quoted fields that contain commas. Everything runs in your browser — nothing is uploaded or stored.

How to Use the HTML to CSV Converter

  1. Paste your HTML into the input box above. It can be a full page, a snippet, or just the <table>...</table> block.
  2. Select HTML as the source format and CSV as the output format (these are usually auto-selected for this page).
  3. Click Convert. The tool finds every <table> in your HTML and extracts its rows and columns.
  4. Copy or download the resulting CSV. Paste it straight into Excel or Google Sheets.

Worked Example: Scraping a Price Table

Imagine you copied this HTML from a product page:

<table>
  <thead>
    <tr><th>Plan</th><th>Monthly Cost</th><th>Users</th></tr>
  </thead>
  <tbody>
    <tr><td>Starter</td><td>$9</td><td>1</td></tr>
    <tr><td>Pro</td><td>$29</td><td>10</td></tr>
    <tr><td>Enterprise</td><td>$99</td><td>Unlimited</td></tr>
  </tbody>
</table>

After converting, you get:

Plan,Monthly Cost,Users
Starter,$9,1
Pro,$29,10
Enterprise,$99,Unlimited

Headers become the first CSV row. Each <tr> becomes a line, each <td> or <th> becomes a field. If a cell contains a comma or a newline, the tool wraps it in double quotes so your spreadsheet parses it correctly.

How to Do This in Python and JavaScript

Prefer to automate the extraction in code? Here are minimal, runnable examples.

Python (using pandas + BeautifulSoup)

import pandas as pd

# pandas reads all <table> tags from a URL or an HTML string
tables = pd.read_html('https://example.com/pricing')  # returns a list of DataFrames
tables[0].to_csv('output.csv', index=False)

pandas.read_html() handles <thead> / <tbody> automatically. If you have local HTML, pass the raw string instead of a URL.

JavaScript (Node.js with node-html-parser)

const { parse } = require('node-html-parser');
const fs = require('fs');

const html = fs.readFileSync('page.html', 'utf8');
const root = parse(html);
const rows = root.querySelectorAll('tr');

const csv = rows.map(row =>
  [...row.querySelectorAll('th, td')]
    .map(cell => `"${cell.text.trim()}"`)
    .join(',')
).join('\n');

fs.writeFileSync('output.csv', csv);

This wraps every cell in double quotes, so commas inside cell text won't break the file. Install the parser with npm install node-html-parser.

How It Works Under the Hood

The converter parses your HTML in the browser using the DOM (the same engine your browser uses to render web pages). It walks through every <table> element it finds, maps <tr> tags to rows and <td>/<th> tags to columns, then serialises the result into valid CSV following RFC 4180 — the widely adopted standard for comma-separated values files.

Fields that contain commas, double quotes, or newlines are automatically wrapped in quotes and escaped. The number-detection pass checks whether each field looks like a plain number and, if so, outputs it without quotes so spreadsheets treat it as numeric.

Your data never leaves your device. The entire conversion happens inside your browser tab — nothing is sent to any server.

When to Use HTML-to-CSV Conversion

  • Web scraping results — you copied a data table from a webpage and need it in a spreadsheet.
  • Email or CMS exports — some platforms let you export as HTML but not CSV directly.
  • Report templates — your company's reporting tool spits out HTML; you want to feed the numbers into Python or Power BI.
  • Quick data analysis — you want to drop a table into Excel or Google Sheets without retyping every cell.

When Another Format Might Suit You Better

SituationBetter choice
You need nested data (e.g., orders with line items)Export to JSON instead — CSV is flat
You need formatting, formulas, or multiple sheetsDownload as Excel (.xlsx)
You want to load data into a databaseUse the SQL export option on this same tool
Your table has merged cells (colspan / rowspan)Manual cleanup may be needed — merged cells don't map cleanly to flat CSV rows

Need to Work with JSON Too?

Once you have your CSV, you might want to validate or transform related data in other formats. These tools on the same site are handy next steps:

Bottom line: if you have an HTML table and need a spreadsheet-ready file, this is the fastest path from markup to data. Paste your table above and download your CSV in seconds.

Frequently asked questions

Is my HTML data uploaded to a server when I convert it?+
No. The conversion runs entirely inside your browser. Your HTML is never sent to any server, so sensitive table data (prices, user records, internal reports) stays completely private on your own device.
What if my HTML has multiple tables? Which one gets converted?+
The tool extracts all tables found in your HTML. If there are several, it usually combines them or lets you choose. Paste only the specific <table> block you care about if you want just one result.
My table uses colspan or rowspan. Will the output be correct?+
Merged cells (colspan / rowspan) don't map cleanly to flat CSV rows because CSV has no concept of a cell spanning multiple columns or rows. The converter will do its best, but you may need to manually adjust cells that were merged in the original HTML.
How do I convert an HTML table to CSV in Python?+
The easiest one-liner is pandas.read_html('your_url_or_html_string')[0].to_csv('output.csv', index=False). Pandas handles thead, tbody, and number detection automatically. If pandas isn't available, BeautifulSoup + the csv module is a solid alternative.
How do I extract a table from an HTML page in JavaScript?+
In a browser, use document.querySelectorAll('tr') to grab rows, then map each row's td / th elements to a comma-joined string. In Node.js, a parser like node-html-parser or cheerio gives you the same API. The worked example on this page shows the complete code.
Does the tool handle cells that contain commas or line breaks?+
Yes. Fields that contain a comma, double quote, or newline are automatically wrapped in double quotes and any internal double quotes are escaped (per RFC 4180). The resulting CSV opens correctly in Excel and Google Sheets without splitting incorrectly.
Is the HTML to CSV converter free? Do I need an account?+
It's completely free and no account or sign-up is required. Just paste your HTML and download the CSV.
Can I convert the CSV back to HTML (or to other formats like JSON or Excel)?+
Yes. The same converter on this page supports 15+ formats including JSON, Excel, SQL, Markdown, and TSV. Select your source and target format from the dropdowns. If you need to work with the JSON output afterward, the JSON Beautifier or JSON Validator tools linked above are useful next steps.