What are XML and CSV?
XML marks data with opening and closing tags and attributes; it is older than JSON and still the format of SOAP services, RSS, Office files and many government and banking integrations. CSV is a table in plain text: the first line names the columns and each following line is a row, with cells separated by commas (or semicolons, tabs or pipes).
Typical for opening a product feed, an export or an API response in XML as a spreadsheet: each repeated element (every <item>, <product>, <row>) becomes one row, and its attributes and child tags become the columns.
This page opens the data converter already set to XML → CSV. Paste the text, read the result as you type, then copy it or download it as a file. Errors show the line and the column. Nothing is sent anywhere: the conversion runs in your browser.
XML vs CSV
| XML | CSV | |
|---|---|---|
| Extension | .xml | .csv |
| Media type | application/xml | text/csv |
| Comments | yes (<!-- -->) | no |
| Data types | everything is text (types come from a schema) | text only (numbers are a reading convention) |
| Nesting | any depth, plus attributes | none: one flat table |
| Typical use | SOAP, RSS, invoices, Office files | spreadsheets, exports, bulk imports |
| Specification | W3C XML 1.0 | RFC 4180 |
When to convert XML to CSV
- Convert to CSV when the data goes to a spreadsheet, a database import or a report.
- Keep XML when a SOAP service, a feed or a legacy system expects XML.
What changes in the conversion
- Comments of the XML file are not carried over: the converter reads the data, and comments are not data.
- CSV is one flat table, so each repeated element (
<item>,<product>,<row>) becomes one row; the header is the union of all their keys, and a nested element or list is written into its cell as JSON text. A document with a single element becomes a one-row table. - Attributes become keys starting with
@(@id), the text of an element that also has attributes becomes#text, repeated elements become a list, and numbers and booleans are recognized.
How to convert XML to CSV
- Paste your XML in the input box (the page opens with an example you can replace).
- Read the CSV on the right; it updates as you type. If something is wrong, the message says the line and column.
- Adjust the options if you need: indentation, sorted keys or type detection.
- Copy the result or download it as a
.csvfile.
Example
This XML input:
<?xml version="1.0"?>
<customers>
<customer id="1"><name>Ana Souza</name><city>Recife</city></customer>
<customer id="2"><name>Bruno Lima</name><city>Porto Alegre</city></customer>
</customers>becomes this CSV, exactly as the converter writes it:
@id,name,city
1,Ana Souza,Recife
2,Bruno Lima,Porto AlegreFrequently asked questions
Is my XML sent to a server?
No. Conversion happens in your browser, so secrets in a config never leave your computer.
Does XML to CSV keep comments?
No. Comments are dropped because the converter works on the data itself. Copy important comments by hand; CSV itself has no comment syntax.
What happens to nested data?
XML nesting: any depth, plus attributes. CSV nesting: none: one flat table. A nested value goes into its cell as JSON text.