HTML Table to CSV
ConvertersConvert HTML tables to CSV format for data analysis. Handles rowspan, colspan, and extracts clean tabular data.. Free, private — all processing in your browser.
The HTML Table to CSV tool extracts data from HTML tables and converts to clean CSV format. Useful for web scraping, extracting data from web pages, converting HTML reports to analyzable format, or any task where you have tabular data in HTML and need it in a spreadsheet or data analysis tool.
Paste HTML source (or just the table HTML) and the tool parses <table>, <tr>, <td>, <th> elements into CSV rows and columns. Handles complex tables with rowspan and colspan attributes. Download CSV or copy to clipboard for pasting into Excel, Google Sheets, or data tools.
HTML Table to CSV — key features
Multiple tables
Extract all tables on a page or pick specific one.
Rowspan colspan
Flatten merged cells into proper grid.
Header detection
Identifies <th> vs <td> for header distinction.
Nested tables
Handle embedded tables with options.
Clean text
Strips HTML formatting, preserves visible text.
CSV output
RFC 4180 compliant with proper quoting.
Preview
See extracted tables before downloading.
Client-side only
HTML stays in your browser.
How to use the HTML Table to CSV
- 1
Paste HTML
Full page HTML or just table source.
- 2
Tool identifies tables
Finds all <table> elements and extracts.
- 3
Preview
See each table’s data before exporting.
- 4
Choose table
If multiple, pick one or export all.
- 5
Download CSV
Save as file or copy to clipboard.
Common use cases for the HTML Table to CSV
Web scraping
- →Data extraction: Pull structured data from web pages for analysis.
- →Wikipedia articles: Extract statistics, tables from Wikipedia.
- →Competitive analysis: Pull tables from competitor websites.
Analysis
- →Import to Excel: Bring web data into spreadsheet for analysis.
- →Python analysis: Convert for pandas.read_csv or similar.
- →Database import: CSV common import format for databases.
Documentation
- →Report conversion: Convert HTML reports to CSV for reuse.
- →Email data extraction: Tables in emails to CSV for processing.
- →Archive: Save web page tables in portable format.
HTML Table to CSV — examples
Simple table
Basic.
HTML table with headers and data rows
CSV with headers as first row, data below
Rowspan
Merged cells.
table where one cell spans 2 rows
Value duplicated in both rows, or blank in second
Multiple tables
Page with several tables.
HTML page with 3 tables
CSV export: combined or separate based on choice
With formatting
Bold, links in cells.
cells with <b>, <a> tags
Text only, bold/italic markers removed, link text kept
Real world
Wikipedia data.
Wikipedia article with stats table
Clean CSV ready for Excel analysis
Technical details
HTML table parsing:
Tables have structure:
<table>
<tr><th>Header1</th><th>Header2</th></tr>
<tr><td>Data1</td><td>Data2</td></tr>
</table>
Parser uses DOMParser to build DOM tree, then extracts:
- <table> elements (may be multiple on page)
- <tr> rows
- <th> or <td> cells
- Text content from each cell
Rowspan handling: a cell with rowspan=\\\"2\\\" occupies its row and the next. In flat CSV, the value repeats in both rows or blank in second (option).
Colspan handling: rowspan=\\\"2\\\" occupies 2 columns. In CSV, value repeats across both columns or occupies first with blanks after.
Nested tables: tables within cells handled by either treating inner table as one cell\u2019s content (stringified) or as separate nested structure (more complex output).
Text extraction: .textContent or similar extracts visible text, stripping HTML formatting. Bold, italics, links lose formatting but text is preserved. Line breaks within cells become spaces.
Output format: CSV per RFC 4180 with proper quoting.
Special cases:
- Merged cells (rowspan + colspan): expand into flat grid with duplicated values or blanks
- Empty cells: empty string in CSV
- Multi-line content in cell: joined with space or newline based on option
- Icons/images in cells: alt text or empty based on option
Multiple tables: if page has many tables, extract specific one by index or all as separate files.
Performance: DOM parsing is fast. Multi-table pages or very large tables (10,000+ rows) work but may be slow.
Common use cases:
- Extract data from Wikipedia articles
- Parse reports from web applications
- Scrape prices/statistics from websites
- Convert HTML emails with tables to CSV
Alternatives: command-line tools like pup or hquery, Python BeautifulSoup, pandas.read_html. This tool is for interactive use without programming.
Common problems and solutions
⚠Complex HTML
Deeply nested tables may confuse extraction. Verify output against source. Real-world HTML varies widely.
⚠Dynamic content
JavaScript-rendered tables not in source HTML. View-source won’t capture; need rendered DOM (inspect element).
⚠Rowspan/colspan edge cases
Complex span combinations may produce gaps or duplicates in CSV. Review output for accuracy.
⚠Nested content
Cells with images, nested tables become stringified in CSV. May look odd but preserves data.
⚠Empty cells
Explicit empty cells become empty strings. Layout tables with many empty cells produce sparse CSV.
⚠Encoding
Ensure HTML source encoding (usually UTF-8) preserved in CSV output.
⚠Large pages
Massive pages (1000+ tables or massive tables) may be slow. Extract specific tables rather than all.
HTML Table to CSV — comparisons and alternatives
Compared to pandas.read_html, this tool requires no programming. pandas is more flexible for automation.
Compared to copying table text and pasting into Excel, this tool preserves structure better. Excel paste may misinterpret.
Compared to web scraping tools (BeautifulSoup), this tool is interactive for one-off conversions. BeautifulSoup for bulk automation.
Frequently asked questions about the HTML Table to CSV
▶How do I extract a table from a webpage?
View page source (Ctrl+U), copy the HTML, paste into this tool. Or use browser Inspect Element to copy specific table. Works on static HTML; for dynamic pages, inspect rendered DOM.
▶Does it handle merged cells?
Yes. Rowspan and colspan attributes parsed; merged cells expanded or marked in flat CSV.
▶Can I extract multiple tables?
Yes. Tool identifies all <table> elements. Export all combined or individually.
▶What about dynamic (JavaScript) tables?
Source HTML (before JS runs) doesn’t include dynamic content. Use browser Inspect Element to get rendered DOM, then copy that HTML.
▶Does formatting survive?
No. HTML formatting (bold, links, etc.) stripped to plain text. Visible cell content preserved.
▶Is my data private?
Yes. All parsing in your browser.
▶Can I scrape with this?
Tool converts HTML you provide. For actual scraping (fetching pages), need additional tool. This processes given HTML.
▶What about tables in PDFs?
This tool is HTML-specific. For PDF tables, use PDF extraction tools first to convert to HTML or direct to CSV.
Additional resources
- HTML table spec — HTML living standard on tables.
- pandas read_html — Python pandas alternative for automation.
- DOMParser — Browser API used for HTML parsing.
- BeautifulSoup — Popular Python HTML parsing library.
- RFC 4180 CSV — CSV specification.
Related tools
All ConvertersCSV to JSON Converter
Convert CSV files to JSON arrays or objects with custom delimiters
CSV to Markdown Table
Convert CSV or TSV data into clean GitHub-flavored markdown tables, bullet lists, or numbered lists with configurable delimiters, alignment, and pipe escaping.
CSV to SQL
Convert CSV data to SQL INSERT statements with auto type detection, escaping, and configurable table name and SQL dialect.
HTML Formatter
Format, indent, and beautify HTML, XHTML, and HTML5 markup
HTML Minifier
Compress HTML by removing whitespace, comments, optional tags — 20-40% smaller
JSON Formatter
Format, validate, and beautify JSON instantly in your browser
Learn more
Explore more tools
200+ free tools that run in your browser.
Browse all tools →