XML to CSV — Convert XML Data to CSV Spreadsheet in Your Browser
Convert XML data to CSV spreadsheet. Handles nested elements, attributes, and repeating rows. Configurable delimiter, runs entirely in your browser.
XML and CSV sit at opposite ends of the data-format complexity spectrum, and converting between them means deciding what to keep and what to flatten. XML can represent nested trees, namespaced attributes, mixed content, and data types via XSD annotations. CSV is a flat grid of strings — rows and columns, nothing more. The conversion from XML to CSV is always a simplification: the tree structure collapses into a table, the hierarchy becomes dot-notation column names, and the rich type system collapses into plain text. The simplification is the point: spreadsheets, databases, and analytics tools consume CSV natively, and the path from a complex XML API response to a pivot table always goes through CSV.
The central decision in every XML-to-CSV conversion is which XML element becomes the row. Most XML documents have a repeating element at exactly the right level — <item> inside <items>, <record> inside <records>, <row> inside <rows> — but some XML documents repeat at multiple levels. A <catalog> might contain <book> elements, each of which contains <author> elements, and the right row level depends on whether you want a list of books or a list of authors. The tool’s auto-detection picks the deepest repeating element by default, which is usually right for flat data exports. The path dropdown lets you pick a different level when the XML’s structure does not match the intended output shape.
For a final hand-off: if the output CSV needs a different delimiter (semicolon for European Excel, tab for clipboard paste, pipe for legacy ETL pipelines), switch the delimiter in the settings before downloading. If the CSV needs to be converted further — to JSON for an API, to YAML for a config file, or to an HTML table for a report — the companion tools on this site accept the CSV directly as input. If the destination is a relational database, most databases accept CSV via a COPY or LOAD DATA command without any intermediate conversion.
How to use
Paste or drop your XML
Drop an XML string or file into the input. The parser reads the XML and identifies repeating elements as rows. The element names become column headers, and nested child elements are flattened into dot-notation columns.
Select the repeating element path
By default, the tool auto-selects the most deeply nested repeating element as the row template. If the XML has multiple candidate levels (e.g. `<orders><order>...</order></orders>`), pick the right path from the dropdown.
Copy or download the CSV
Comma is the default delimiter. Switch to semicolon, tab, or pipe in the settings. The output CSV is UTF-8 with a BOM for seamless Excel import. Download as .csv or copy to clipboard.
Frequently asked
What qualifies as a 'row' element in the XML?
The converter looks for repeating child elements — siblings with the same tag name that appear at least twice. A structure like `<books><book>...</book><book>...</book></books>` has `<book>` as the row element. If multiple levels repeat, pick the intended level from the path dropdown.
How are XML attributes handled in the CSV output?
XML attributes on the row element become columns prefixed with `@` by default (e.g. `@id` for `<book id="123">...</book>`). Attributes on nested child elements are flatten into the child's dot-notation path. You can disable attribute extraction in the settings.
What happens to XML with deeply nested structure?
Nested elements are flattened into dot-notation column names. `<person><address><city>Berlin</city></address></person>` becomes a column `address.city` with value `Berlin`. Arrays of nested elements produce multiple rows if the parent repeats, or a concatenated cell if not.
Can I set a custom value for empty or missing elements?
Yes. The 'default for missing nodes' setting lets you fill empty cells. Choose an empty string (the default), `NULL`, `N/A`, or a custom placeholder. This is useful when not every row has the same nested elements.
Limitations
- No XML namespace resolutionXML namespaces (`<ns:book xmlns:ns="...">`) are included in the tag name column headers as written. The namespace prefix is not resolved to a full URI and the column name may be verbose.
- Mixed content is approximateElements with both text and child elements (mixed content, common in XHTML) are handled by extracting the text content and ignoring embedded tags. The structure is not preserved.
- No schema validation or type inferenceAll cell values are treated as strings. The converter does not infer numeric types, dates, or booleans. Apply type conversion in your spreadsheet application after import.
Platform notes
- macOS
- Numbers and Excel for Mac import CSV with UTF-8 BOM cleanly. The browser tool is the right pick for one-off XML-to-CSV conversion where writing a script for xmlstarlet or Python is more setup than the conversion is worth.
- Linux
- CLI equivalent: `xmlstarlet sel -t -m '//row' ...` with template output. The browser tool is the right pick for ad-hoc conversion of XML pasted from an API response or a chat message.
- Web
- Runs entirely client-side. Works offline once the page has loaded. The parsed XML never leaves your browser — no data is uploaded to any server.