Convert HTML to CSV

Paste HTML below — the converter extracts every table, you pick which one, download a clean CSV. 100% private.

Delimiter:

How to convert HTML to CSV

The fastest way to convert HTML to CSV: paste the HTML (or upload an .html file) into the converter at the top of this page. The tool finds every <table> in the markup, lets you pick which one to export, and gives you a clean comma-separated file. Runs entirely in your browser using the native DOM parser — no upload, no signup.

  1. Paste the HTML. Copy the source of the page, or paste just the table — the parser handles either. You can also drop in an .html file.
  2. Pick the table. If the markup contains multiple tables, the dropdown lists them with their dimensions (e.g. Table 2 — 14 rows × 6 cols). Pick the one you want.
  3. Pick the delimiter. Comma is standard. Semicolon for European Excel. Tab if your data contains commas.
  4. Click Download CSV. A clean file saves to your downloads folder.

Going the other direction? Use CSV to HTML (coming soon).

How to convert an HTML table to CSV

Most “html to csv” jobs are really “html table to csv” — extracting a <table> element from a webpage and turning it into rows and cells. The converter above handles every flavor of <table> markup:

  • Tables with <thead> + <tbody> (semantic HTML)
  • Tables with no <thead> (the first row is treated as the header)
  • Tables with <th> cells anywhere in the body
  • Cells containing <br> tags (preserved as line breaks inside the cell)
  • Cells with colspan and rowspan (expanded to repeated values across spanned cells)

If your HTML has weird quirks the parser misses, paste a sample into our contact form and we’ll add a test case.

How to convert HTML to CSV without code

Three options, ranked by speed:

1. Use the converter above

Paste the HTML, click Download CSV. Total time: about ten seconds. Works on any browser, any OS, no install.

2. Use Excel’s import (Microsoft 365)

Microsoft 365 Excel can import HTML tables directly:

  1. Data → Get Data → From Web.
  2. Paste the URL of the page containing the table.
  3. Excel parses every table on the page and lists them.
  4. Tick the table(s) you want, click Load.
  5. File → Save As → CSV UTF-8 (Comma delimited) to export.

Solid for live web pages, but requires Microsoft 365 and works less well with pasted HTML snippets.

3. Copy and paste

Open the page in a browser → select the table → copy → paste into Excel → File → Save As → CSV. Quick for a single table on a single page, but breaks on complex layouts (merged cells, nested tables).

How to convert HTML to CSV in JavaScript

If you need to do this programmatically — e.g. inside a build script — the cleanest approach uses the browser’s DOMParser:

function htmlTableToCsv(html, tableIndex = 0) {
  const doc = new DOMParser().parseFromString(html, "text/html");
  const table = doc.querySelectorAll("table")[tableIndex];
  if (!table) return "";
  const rows = [...table.querySelectorAll("tr")];
  return rows
    .map((row) =>
      [...row.querySelectorAll("th, td")]
        .map((cell) => {
          const text = cell.textContent.trim().replace(/"/g, '""');
          return `"${text}"`;
        })
        .join(",")
    )
    .join("\n");
}

This handles the basic case (no colspan or rowspan). The converter at the top of this page is a fuller implementation — extract the source if you want a starting point.

Outside the browser, Node has packages like node-html-parser or cheerio that work the same way; Python uses BeautifulSoup, and Pandas has a one-liner: pd.read_html("https://example.com/page")[0].to_csv().

Converting HTML to CSV: common problems

”The table has merged cells (colspan/rowspan) and the CSV looks wrong”

The converter expands merged cells into repeated values across the spanned columns/rows. If you’d rather see blanks for the merged cells, edit the resulting CSV — or open the source HTML and split the merged cells before converting.

”There are multiple tables and I want them all”

Run the converter once per table, name the output files differently, then merge them with our CSV merger. For deeply automated workflows, the JavaScript snippet above iterates through doc.querySelectorAll("table") to dump them all in one go.

”My HTML contains entities like &amp; and &nbsp;

The DOM parser decodes HTML entities natively, so &amp; becomes & in the CSV, &nbsp; becomes a regular space. If you need to preserve the entity, edit the CSV after export — but most importers (Excel, databases) want the decoded version.

”The CSV opens broken in Excel”

Almost always a delimiter mismatch — Excel on French/German locales expects semicolons. Either pick the Semicolon option in the converter, or use our delimiter converter to switch the file after export. See why your CSV shows in one column for the full story.

”The result has weird whitespace in cells”

HTML tables often have indentation and line breaks for readability that survive into textContent. The converter trims surrounding whitespace from each cell, but multi-line content inside a single <td> is preserved. To strip internal newlines too, post-process the CSV with a regex: replace \s+ with a single space.

Why convert HTML to CSV?

  • Scraping a public table — pricing, sports stats, schedules, leaderboards, Wikipedia data — into a working dataset.
  • Importing exported reports — many web apps export reports as HTML “for printing” without a CSV option. This bridges the gap.
  • Bulk-editing in Excel — once it’s a CSV, you can sort, filter, pivot, and edit the data in any spreadsheet.
  • Loading into a databaseCOPY FROM ... CSV (Postgres) or LOAD DATA INFILE (MySQL) need CSV, not HTML.
  • Feeding into another tool — most ETL pipelines, BI tools, and notebooks read CSV directly.

After converting, you can clean up further:

Privacy: nothing is uploaded

The HTML-to-CSV conversion uses the browser’s built-in DOMParser — no external library, no server. Whatever HTML you paste stays in your tab’s memory; nothing is uploaded. Useful when the HTML you’re processing is from an internal dashboard, an authenticated page, or anything you wouldn’t paste into a public converter.

Related tools

Frequently asked questions

  • How do I convert HTML to CSV?

    Paste your HTML (or upload an .html file) into the converter at the top of this page, pick which table to export, choose a delimiter, and click Download CSV. Total time is about ten seconds.

  • Can I convert an HTML table to CSV?

    Yes — that's what the converter is built for. It finds every <table> element in the HTML, parses rows and cells, and exports as CSV. Tables with thead/tbody, mixed th/td, and merged cells (colspan/rowspan) all work.

  • What if the HTML has multiple tables?

    The dropdown lists every detected table with its row × column dimensions. Pick the one you want and the CSV updates instantly. To export every table, run the converter once per table.

  • Does the converter handle merged cells?

    Yes. Cells with colspan or rowspan get expanded — the same value is repeated across the spanned columns/rows so the resulting CSV is rectangular.

  • How do I convert HTML to CSV in JavaScript?

    Use the browser's DOMParser to parse the HTML, then iterate <tr> and <td>/<th> elements. The article below has a working snippet — or just use the converter at the top of this page.

  • Can I convert HTML to CSV without code?

    Yes — use the converter at the top, or import the HTML page in Microsoft 365 Excel via Data → Get Data → From Web. Both avoid any coding.

  • Is my HTML uploaded?

    No. The converter uses your browser's native DOMParser. Whatever HTML you paste stays in the tab's memory; nothing is sent to a server. Verify in DevTools → Network.