01What is XML to CSV?
Plenty of systems still export XML, and most of those exports share one shape underneath: a root element holding a list of repeated records. This converter takes that shape and turns it into CSV you can open in Excel, Google Sheets or a database import. The input is read with the browser's built-in DOMParser, which follows the W3C XML 1.0 rules. That means malformed XML, such as a mismatched closing tag or a bare ampersand, is rejected with the parser's own error message. Entities like & and < are decoded. CDATA sections are read as plain text. The <?xml?> declaration and comments are skipped. Then the flattening starts. Every direct child of the root becomes one row. Attributes on that record element become columns with an @ prefix, so <employee id="E001"> gives an @id column. Each child element becomes a column named after its tag. The header row is the union of every column seen across all records, in the order they first appear. A record that lacks a field simply gets an empty cell. Anything nested one level deeper is squashed into a single cell. The text of those grandchildren is joined with a semicolon and a space. If one record repeats the same child tag, say two <phone> elements, both values land in one cell joined the same way. Output fields that contain a comma, a double quote or a line break are wrapped in quotes, with inner quotes doubled, as RFC 4180 describes. Here is a short example. Feed it <users> with two <user> records. The first has id="1", role="admin" and a name of Ann. The second has id="2", a name of Bo and an email. You get the header @id,@role,name,email. Row one is 1,admin,Ann, with a trailing empty email. Row two is 2,,Bo,[email protected] with the role cell left blank. Some honest limits. Rows only come from the root's direct children, so deeply wrapped records need trimming first. Namespace prefixes stay in the column name, so you will see headers like dc:creator. Text sitting directly inside a record next to child elements is ignored. And when the root has no child elements at all, you get an error instead of an empty file. Parsing happens inside your browser tab, so the XML you paste never reaches our server.
Data analysts, developers maintaining legacy integrations and anyone who needs a list of XML records as spreadsheet rows. The tool runs entirely in your browser, so your data never leaves your device.
02How to use XML to CSV
- Paste your XML into XML Input, or pick one of the built-in examples
- Read the CSV Output, including any @attribute columns
- If an Invalid XML error appears, fix the line in the source it points to
- If the error says no repeating elements were found, paste the element that wraps your records
- Click Copy CSV and paste into a .csv file or spreadsheet
03Worked examples
- Input:
<users><user id="1" role="admin"><name>Ann</name></user><user id="2"><name>Bo</name><email>[email protected]</email></user></users> - Result:
@id,@role,name,email 1,admin,Ann, 2,,Bo,[email protected] - Attributes become @-prefixed columns, and columns missing from a row are left empty.
- Input:
<rows><row><name>Smith, J</name><note>He said "hi"</note></row></rows> - Result:
name,note "Smith, J","He said ""hi""" - Fields with commas or quotes are wrapped in quotes and inner quotes are doubled.
- Input:
<orders><order><id>7</id><items><item>pen</item><item>ink</item></items></order></orders> - Result:
id,items 7,pen; ink - Nested children are joined with "; " into one cell rather than becoming extra columns.
- Input:
<list><tag>a & b</tag><tag><![CDATA[<b>x</b>]]></tag></list> - Result:
tag a & b <b>x</b> - Entities are decoded and CDATA content is taken literally.
- Input:
<empty/> - Result:
Error: No repeating elements found. XML must have child elements to convert to CSV rows. - Each direct child of the root becomes a row, so a root with no children has nothing to convert.
04Common use cases
- Turning a product feed or catalog export into a spreadsheet for review
- Converting an RSS feed's items into rows for a content audit
- Opening a legacy system's XML report in Excel or Google Sheets
- Preparing XML data for import into a database via CSV
- Comparing records from two XML exports using spreadsheet formulas
- Pulling attribute values like id or sku out of a config or sitemap-style XML file into a list
05Tips
- Rows come from the root's direct children. If your records sit deeper, like <response><items><item>, paste just the <items> section.
- Entities are decoded, so Tom & Jerry arrives in the CSV as Tom & Jerry; you don't need to clean them up afterwards.
- If you get an Invalid XML error, look for an unescaped & or < in text, the most common reason exported XML fails to parse.
- Columns appear in the order fields are first seen, so put the most complete record first for a tidy header.
- If a record has repeated child tags, like several <phone> elements, they share one column and are joined with "; " in a single cell.
06Related concepts
XML parsing, CSV, flattening, XML attributes, data conversion.
Frequently Asked Questions
What is XML to CSV?
XML to CSV is a free, browser-based developer tool on AIDToolStack. Flatten XML to CSV format It requires no installation or sign-up and works entirely in your browser.
Is XML to CSV free to use?
Yes. No sign-up, no fees and no usage cap.
Does XML to CSV store my data?
No. It runs in your browser; nothing is uploaded.