XML to CSV Converter
Paste XML or open an .xml file and get a clean CSV table: the converter finds the repeating record elements, turns attributes and nested elements into columns, and lets you choose which columns to keep. Nothing is uploaded.
Your XML is parsed by your browser and never uploaded. Tip: Ctrl + Enter converts.
How to use the XML to CSV Converter
- Paste your XML into the left box or open an .xml, .rss or .gpx file. A sample catalog is loaded to start.
- Check the record element. Auto-detect picks the most frequent repeating element; choose another from the list if needed.
- Adjust flattening: column name style for nested elements, how repeated children are handled and how attributes are named.
- Untick columns you do not need and choose the delimiter.
- Press Download .csv or Copy CSV. Tick Excel-friendly if you will open the file in Excel.
Example: how XML is flattened
Take one record from the sample catalog:
<book id="bk101" lang="en">
<title>XML Developer's Guide</title>
<author><name>Matthew Gambardella</name><country>US</country></author>
<price currency="USD">44.95</price>
<tag>xml</tag><tag>reference</tag>
</book>With the default settings it becomes one CSV row with these columns:
| id | lang | title | author.name | author.country | price | price.currency | tag |
|---|---|---|---|---|---|---|---|
| bk101 | en | XML Developer's Guide | Matthew Gambardella | US | 44.95 | USD | xml; reference |
Records that lack an element simply get an empty cell in that column, so the table always stays rectangular.
Flattening rules at a glance
| XML structure | CSV result |
|---|---|
Attribute on the record: <book id="7"> | Column id (or @id) |
Child element: <title>…</title> | Column title |
Nested element: <author><name> | Column author.name |
Element with value and attribute: <price currency="USD">5</price> | Columns price and price.currency |
Repeated element: <tag>a</tag><tag>b</tag> | a; b in one cell, or tag[1], tag[2] |
CDATA: <![CDATA[a & b]]> | Plain text a & b |
| Mixed text and elements | Extra #text column for the loose text |
Tips
- RSS feeds: choose
<item>as the record element to get one row per post with title, link and pubDate. - Deeply nested exports: if rows look wrong, pick a deeper repeating element such as
order/lineto get one row per order line. - Going the other way? Use the CSV to XML Converter, or tidy XML first with the XML Formatter.
Frequently asked questions
How does the converter decide what a row is?
It looks for elements that repeat under the same parent, such as many <book> elements inside <catalog>. Repeating elements that have their own children or attributes are preferred, and among those the most frequent one wins. Every matching element becomes one CSV row. You can pick a different element in the Record element list, or treat the whole document as a single row.
How are nested elements and attributes turned into columns?
Each leaf element becomes a column named by its path relative to the record, joined with the separator you choose, so <author><name> becomes author.name. Attributes become columns named after the attribute (or @attribute), and an attribute on a nested element becomes, for example, price.currency.
What happens when a child element repeats inside one record?
By default the values are joined in a single cell separated by a semicolon and a space, for example xml; reference. Choose numbered columns to get tag[1], tag[2] and so on instead, which is better when you need each value in its own cell.
Why do accented characters look wrong in Excel?
Excel often opens CSV files using a legacy code page instead of UTF-8. Tick Excel-friendly (UTF-8 BOM) before downloading: the file then starts with a byte order mark that tells Excel to read it as UTF-8. In some regions Excel also expects a semicolon delimiter.
Which XML is supported?
Any well-formed XML, including RSS and Atom feeds, sitemaps, GPX tracks, KML and exports from databases or ERP systems. CDATA sections are read as text, standard entities are decoded, and namespace prefixes are kept in column names. HTML-only entities such as are not valid XML and are reported as an error.
How large a file can I convert?
Files of several megabytes convert in a moment. Very large files (tens of megabytes) depend on your device's memory, because the whole document is parsed in the browser. The preview shows the first 100 rows, but the CSV contains all of them.
Is my XML uploaded to a server?
No. The XML is parsed with your browser's built-in DOMParser and the CSV is built in this page, so your data never leaves your device.