XML to CSV Converter
Flatten a repeating XML structure into a clean CSV table. The converter auto-detects the record element (the child name that repeats most under a shared parent), so a list of <book> or <order> elements becomes one row each. Columns are the union of every record's child elements, optionally including attributes. Fields containing commas, quotes, or newlines are quoted per RFC 4180 so the output opens cleanly in Excel, Google Sheets, or any CSV parser.
How to use the XML to CSV Converter
Paste your XML and the tool parses it with the browser's DOMParser. It then finds the record element — the element name that occurs most often as a direct child of a shared parent — and treats each occurrence as one CSV row. If the auto-detection picks the wrong element, type the correct tag name into the Record element field to override it.
Columns are built from the union of every record's child-element names, in first-seen order, so records with missing fields still line up; absent cells are left empty. Tick Include attributes as columns to add a column for each attribute found on the record elements (attribute columns are prefixed with @). Pick a delimiter — comma, semicolon, or tab — and toggle the header row off if your downstream consumer does not want one. Use Download .csv to save the result or Copy to grab it for a spreadsheet.
What is the XML to CSV Converter?
XML and CSV sit at opposite ends of the data-shape spectrum. XML is a tree: elements nest arbitrarily deep, can repeat, and carry both child elements and attributes. CSV is a flat grid of rows and columns with no nesting at all. Converting one to the other is therefore inherently lossy in one direction — you have to pick a single level of the tree to become your rows. That level is the repeating record element: in a document like <catalog><book>…</book><book>…</book></catalog>, the book elements are the records and everything inside each book becomes that row's cells.
Auto-detection works by counting, for every parent in the document, how many same-named children it has, and choosing the name with the highest repeat count. That heuristic handles the overwhelmingly common "list of things" XML you get from APIs, exports, and feeds, but ambiguous documents (deeply nested or with several competing lists) may need the manual override. Once records are chosen, columns are the union of all child-element local names so the grid is rectangular even when individual records omit fields. Attributes are a separate modeling decision: XML lets you put a value in either an element (<price>9.99</price>) or an attribute (<item price="9.99"/>), and only you know which matter, so attribute columns are opt-in and namespaced with @ to avoid colliding with element columns of the same name.
The output follows RFC 4180 quoting: any field that contains the delimiter, a double quote, or a line break is wrapped in double quotes, and embedded double quotes are escaped by doubling them (" becomes ""). This is what lets a free-text XML field with commas and newlines survive the trip into a spreadsheet without shifting columns. If you need the inverse direction or a nested representation instead of a flat table, see the XML to JSON converter.
Common use cases
- Spreadsheet import — turn an XML data export into a CSV you can open directly in Excel or Google Sheets for filtering and pivot tables.
- RSS / Atom feeds to a table — flatten
<item>or<entry>elements into rows of title, link, and date for analysis. - Legacy API responses — convert SOAP or XML-RPC result lists into CSV for ad-hoc reporting without writing an XSLT.
- Database / bulk-load prep — produce a clean delimited file from XML to feed
LOAD DATA,COPY, or a spreadsheet-based import. - Catalog and inventory exports — flatten product or order XML into one row per SKU, including price and SKU attributes when needed.
- Quick data inspection — eyeball a large XML file as a grid instead of scrolling through angle brackets.