XML to CSV Converter
Collapse an XML document into comma-separated values with a header row — ready for a spreadsheet import, a database load, or a quick grep.
Flattening a tree into a table
CSV is the lingua franca of tabular data — every spreadsheet, database and analytics tool can read it. XML, by contrast, is built for nesting. This converter bridges the two by flattening your XML into a flat record and emitting it as comma-separated values, with the first line acting as a header row drawn from the element paths.
Under the hood, xml2js turns the XML into a JavaScript object and a flatten step walks that object, joining nested keys with dots. Each leaf value becomes a column. Every field is wrapped in double quotes so that commas, line breaks or quotes inside a value don't break the column boundaries.
The whole thing happens in your browser. Whether you're prepping a dataset for Excel or piping records into a load script, the XML never leaves your machine.
From XML to a clean CSV
- 1
Paste the XML
Add your XML to the input pane or upload an .xml file. Try the sample to see the shape of the output.
- 2
See the CSV form
As you type, the converter flattens the structure and renders the header row plus data rows in the output pane.
- 3
Check the columns
Confirm the dot-joined headers line up with the fields you expect. Invalid XML is flagged before you rely on it.
- 4
Copy or download
Grab the CSV text directly, or download it as a .csv file for your spreadsheet or import job.
Why CSV is still worth it
Universal import
Practically every tool — Excel, Sheets, Postgres, pandas — ingests CSV without a second thought.
Quoted values by default
Each field is double-quoted, so commas and special characters inside your data won't shift the columns.
Readable nested headers
Nested elements collapse into dot-notation column names, so you never lose track of where a value came from.
Private and offline-capable
Conversion runs in the browser, making it safe for customer lists or internal exports.
Records in, rows out
A flat XML record on the left, the quoted CSV it produces on the right.
<contact>
<name>Grace Hopper</name>
<email>grace@navy.mil</email>
<role>Rear Admiral</role>
</contact>contact.name,contact.email,contact.role
"Grace Hopper","grace@navy.mil","Rear Admiral"How the header row is built
The converter derives column names from the keys of the first flattened record. A nested element such as <contact><email> becomes the header contact.email. Because the header is taken from the first row, the cleanest results come from XML where every record carries the same set of fields — irregular records can leave gaps you'll want to check.
Good fits and rough edges
- Best for flat-ish, record-style XML: a list of products, orders, users or rows from an export.
- Deeply irregular documents — where records have wildly different fields — flatten less cleanly, since columns come from the first record.
- Every value is quoted, which is the safe default; if your downstream tool is strict about quoting empties, trim as needed.
- Need a tab delimiter instead of commas? Use the XML to TSV converter — it's the same idea with tabs.
Frequently asked questions
They're built from the keys of the flattened record. Nested elements become dot-joined names — a name inside a contact becomes the header contact.name. The first record decides the header order.
Quoting every field is the safe default. It guarantees that a comma, quote or newline sitting inside one of your values can't spill over and break the column alignment when the CSV is parsed.
It's flattened with dot notation, so a city inside an address inside a user becomes user.address.city. Very irregular structures flatten less cleanly, so it works best on uniform, record-style data.
No. Both the XML parsing and the CSV generation run in your browser. Customer lists and internal exports stay on your device the entire time.
Yes. Download the .csv and open it in Excel, Google Sheets or any spreadsheet app. If you'd rather skip the import step entirely, the XML to Excel tool produces a native .xlsx instead.
Only the delimiter. CSV separates fields with commas; TSV uses tab characters, which can be handier when your values themselves contain commas. The flattening logic is otherwise the same.
Need another tool?
Browse the full toolbox or dig into the blog for the engineering behind it.