How to Convert an HTML Table to CSV
To convert an HTML table to CSV, paste the table into the box above. The tool reads the rows and cells, joins the cells of each row with a separator and writes one line per row. Cells that contain the separator, a double quote or a line break are put in double quotes, as the CSV format asks. With the Example the first table gives:
Name,Role,Notes
Ada Lovelace,Mathematician,"Wrote the first program, in 1843"
Linus,Engineer,Pipes | and more
Grace Hopper (admiral),Grace Hopper (admiral),"Line one
Line two"The comma in the Notes cell would have split it into two columns, so that cell is quoted. The last cell holds a line break, so it is quoted too and stays one cell that spans two lines. The tool reads the text only. It does not run scripts that are inside the pasted HTML.
Copy a Table from a Web Page and Paste It Here
Select the table on the page, copy it and paste it into the box. Browsers put the table on the clipboard as HTML as well as plain text, and the tool takes the HTML version, so the structure is kept. If only plain text is on the clipboard and it has tabs between the cells, which is what a spreadsheet copy gives, the tool reads that as a table too.
To get a table from the page source instead, open the developer tools, copy the outer HTML of the <table> element and paste it. A whole page also works. The tool finds every table in it and ignores the rest of the page. If you have HTML that is not a table and you only want its text, use Remove HTML Tags.
Merged Cells: Colspan and Rowspan
A cell can span several columns (colspan) or rows (rowspan). CSV has no way to merge cells, so the tool has to fill the gap. Merged cells has two settings. Repeat the value copies the text into every cell the merged cell covered, which keeps each row complete and is best for sorting and filtering. Leave the others empty puts the text in the first cell only.
In the Example the last row has a cell that spans two columns. With Repeat the value you get Grace Hopper (admiral) in both columns, and with Leave the others empty the second one is blank. Rows that are shorter than the longest row are filled with empty cells, so every line has the same number of columns.
Open the CSV in Excel or Google Sheets
Download the file and open it in Excel, Google Sheets, LibreOffice or any other spreadsheet program. Google Sheets opens it from File, then Import. In Excel, double-clicking a .csv file usually works. Use Data, then From Text/CSV if you want to choose the separator and the encoding.
- Everything ends up in one column: the program expects a different separator. Many European settings use a semicolon, so set Separator to Semicolon and convert again.
- Accents or symbols look wrong in Excel: turn on UTF-8 BOM for Excel and download again. The BOM is a short marker at the start of the file that tells Excel the text is UTF-8.
- Numbers lose leading zeros: spreadsheets treat a cell like 00123 as a number. Import the column as text.
The BOM is added to the downloaded file only. The text you copy has no BOM. To turn CSV back into table code, use CSV to HTML Table. If you need to go from CSV to a Markdown table afterwards, use CSV to Markdown, and for a spreadsheet from JSON there is JSON to Excel.
Line Breaks, Links and Footnote Markers
- A <br> tag inside a cell becomes a line break in that cell. Keep leaves it inside the quotes. Turn into a space joins the lines, which is easier for tools that read one line per row.
- A link keeps its text and drops the address. An image keeps its alt text. Bold, italic and other styling is dropped, and so are scripts and style blocks.
- A table inside a cell is flattened into that cell as text, and is not listed as a separate table.
- Remove [1] markers deletes references such as [1], [a], [note 2] and [citation needed], which are common in tables copied from encyclopedias. It leaves other square brackets alone.
- Extra spaces and the line breaks of the HTML source are collapsed, and non-breaking spaces become normal spaces.
Text such as & and © in the HTML is decoded to the real characters. The tool knows the common named entities and all numeric ones. An unknown name is left as written.
Download a CSV from an HTML Table with JavaScript
If you only need this on a page you control, a few lines of JavaScript are enough. Run this in the browser console on a page with a table, and it saves the first table as table.csv:
const table = document.querySelector("table");
const rows = [...table.rows].map((row) =>
[...row.cells].map((cell) => `"${cell.innerText.replace(/"/g, '""')}"`).join(",")
);
const link = document.createElement("a");
link.href = URL.createObjectURL(new Blob([rows.join("\n")], { type: "text/csv" }));
link.download = "table.csv";
link.click();The snippet quotes every cell and ignores colspan and rowspan, so merged cells will leave gaps. This tool handles those cases, picks a table for you and works on HTML you paste, without running anything on the original page.
Limits and Privacy
The tool cannot fetch a web page by its address, because a browser tool is not allowed to read other sites. Copy the table or its HTML instead. It does not read .xlsx files, and it finds up to 200 tables in one paste. Input is limited to 2,000,000 characters.
Cells that start with =, +, - or @ are written as they are. If the source is not trusted, check the file before you open it in a spreadsheet, because a spreadsheet may treat such a cell as a formula. Respect the terms of the sites you copy data from.
The conversion runs in your browser. The HTML is not sent to a server and is not stored. See the Privacy Policy for details. To turn the same table into Markdown for a README or a wiki, use HTML Table to Markdown.