XML to CSV
Turn an XML document into a table. The converter finds the repeating elements that represent records, such as each <book> in a catalogue or each <item> in a feed, and turns their child elements and attributes into columns, flattening nested elements into dotted names. You can name the record element yourself, and the CSV is quoted and protected for spreadsheets.
- Runs in your browser
- No sign-up
- Free to use
How to use XML to CSV
- Paste XML or open a file.
- Check the detected record element, or type one.
- Choose the delimiter and whether to include attributes.
- Copy or download the CSV.
XML to CSV features
Record detection
Finds the most repeated element automatically.
Columns from structure
Child elements, attributes and nested paths.
Friendly names
price.#text becomes price, @id becomes id.
Lists kept
Repeated child elements written as JSON lists.
Safe CSV
Proper quoting and formula-injection protection.
Local
Parsed in your browser with error positions.
When to use XML to CSV
- Opening a product feed or sitemap in a spreadsheet.
- Converting an XML export from accounting or ERP software.
- Analysing RSS or Atom entries in Excel.
- Preparing XML data for import into a database.
XML to CSV FAQ
How does it know what a record is?
It looks for the element name that repeats most often under one parent, such as <book> inside <catalog>. If it guesses wrong, type the element name in the box.
What happens to attributes?
Each attribute becomes a column. Untick the option to keep only element content.
How are nested elements handled?
They become dotted column names, such as price.currency. Elements that repeat inside a record are written as JSON lists in one cell.
What if the XML is invalid?
The parser reports the line and column of the first error, so you can fix it.
Can I convert CSV to XML?
Use CSV to JSON and then JSON to XML, or the SQL to XML tool for database rows.
Is my file uploaded?
No. Everything runs in your browser.
Flattening XML into rows and columns
XML documents are trees, while CSV files are grids. Most XML data exports, though, are really lists of similar records wrapped in a container: products in a catalogue, entries in a feed, transactions in a statement. Converting such documents to CSV means finding the records and turning their contents into columns.
Record detection looks for the element name with the most siblings of the same name anywhere in the document, which is almost always the record element. When a document contains several lists, or the automatic choice is not the one you want, type the element name and every element with that name becomes a row.
Within each record, child elements and attributes become columns. Nested elements produce dotted column names that show where the value came from, attribute markers and text markers are tidied up so that <price currency="USD">9.99</price> gives price and price.currency columns. Records with different children still share one header, with empty cells where a value is missing.
Some structures do not fit in a single cell. When a record contains several elements of the same name, such as a list of tags, they are written as a JSON list, which keeps the information and can be split later in a spreadsheet or script.
The XML is parsed with your browser’s standards-compliant parser, which reports the position of any error. The CSV uses standard quoting and protects against formula injection, so values beginning with = cannot run as formulas when the file is opened.