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.
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
- Paste your HTML into the input box above. It can be a full page, a snippet, or just the
<table>...</table>block. - Select HTML as the source format and CSV as the output format (these are usually auto-selected for this page).
- Click Convert. The tool finds every
<table>in your HTML and extracts its rows and columns. - 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
| Situation | Better choice |
|---|---|
| You need nested data (e.g., orders with line items) | Export to JSON instead — CSV is flat |
| You need formatting, formulas, or multiple sheets | Download as Excel (.xlsx) |
| You want to load data into a database | Use 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:
- JSON Beautifier — Format, Validate & Minify JSON Online — make messy JSON readable in one click.
- JSON Validator — Check & Fix JSON Errors Online (Free) — catch syntax errors before your app crashes on bad data.
- JSON to YAML Converter — Convert JSON to YAML Online (Free) — useful when your pipeline ingests YAML config files.
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.