Convert XML to CSV online with Calzyra. Turn XML records into rows and columns, preserve field values, and copy your CSV output for spreadsheets and data workflows.
CSV output will appear here
Paste XML in the input panel and it converts automatically
Load sample data to get started
What this tool can do
Records to Rows
Repeated XML elements become CSV rows
Nested Columns
Nested fields flatten to dot-notation columns
Attribute Columns
Attributes become @-prefixed columns
RFC 4180 Escaping
Commas, quotes and line breaks stay in one cell
Real XML Parsing
Malformed XML reports the error instead of bad CSV
Copy & Download
Copy the CSV or download it as a .csv file
Dark Mode
Easy on the eyes for long sessions
Keyboard Shortcuts
Navigate efficiently with hotkeys
Methodology and approach
The converter parses the document with a real XML parser, picks the repeating child elements of the root as records, maps every attribute and nested field onto dot-notation columns and escapes each cell per RFC 4180.
XML stores data as a tree: elements nest inside elements, attributes ride on tags, and text sits in the leaves. CSV stores the same kind of record data as a flat table - a header row of column names, then one line per record with the values separated by commas. Converting XML to CSV means choosing which elements become rows, which become columns, and how the tree is flattened so a spreadsheet can read it.
That mapping is what this tool performs. Paste a document, and its repeating records become rows, their child elements become columns, and every value is written with the CSV quoting rules Excel and Google Sheets expect.
Paste your XML into the input panel on the left. The document is parsed and converted automatically as you type, and Ctrl+Enter forces a re-run at any time. The generated CSV appears in the output panel on the right, with a status line reporting how many records and columns were produced.
If the XML is malformed - a missing closing tag, a mismatched pair, an entity the document never declares - the output panel clears and reports the parser error with its line and column instead of showing stale or misleading CSV. Your input is never modified, so you can fix the problem in place and the CSV updates on its own.
When the result looks right, Copy puts the CSV on the clipboard and Download saves it as converted.csv. Everything runs in your browser; nothing is uploaded.
The document below holds two <product> records. Each repeated <product> element becomes one CSV row, and each of its child elements - id, name and price - becomes a column with the same name.
This is the shape of most XML exports: a wrapper element, then many identical record elements inside it. The converter looks for exactly that repetition to decide what a row is.
<?xml version="1.0" encoding="UTF-8"?>
<products>
<product>
<id>101</id>
<name>Keyboard</name>
<price>49.99</price>
</product>
<product>
<id>102</id>
<name>Mouse</name>
<price>24.50</price>
</product>
</products>id,name,price
101,Keyboard,49.99
102,Mouse,24.50Every child element of a record contributes a column named after it, and the element's text becomes the cell value. Columns are collected from every record in the document, not just the first one, so a later record with an extra field keeps that field; a record that is missing a field simply leaves the cell empty and the values stay in the right columns.
A record whose children repeat inside a single element - several <tag> children on one product, for instance - cannot have one column per value, so those values are joined into a single cell with a semicolon between them. No value is overwritten or dropped.
CSV has no nesting, so a nested element is flattened into one column per leaf value and named with the path that leads to it - address.city rather than a cell holding a subtree. The path uses dots between levels, which is what a spreadsheet filter and a SQL WHERE clause both expect.
Elements that mix text with child elements keep the text in a #text column at their own path, so mixed content is not lost. Nesting deeper than eight levels is joined into a single cell instead of being split further, and the tool reports when that happens.
<customers>
<customer>
<name>Ayesha</name>
<address>
<city>Lahore</city>
<country>Pakistan</country>
</address>
</customer>
<customer>
<name>Ali</name>
<address>
<city>Karachi</city>
<country>Pakistan</country>
</address>
</customer>
</customers>name,address.city,address.country
Ayesha,Lahore,Pakistan
Ali,Karachi,PakistanAttributes are included in the CSV. An attribute becomes a column prefixed with @ at the same path level as its element - id="101" on a product record becomes an @id column, and currency="USD" on a price element becomes price.@currency. This matches the @ convention the Calzyra XML to JSON converter already uses, so the two tools describe the same document the same way.
<products>
<product id="101" category="office">
<name>Keyboard</name>
<price currency="USD">49.99</price>
</product>
</products>@id,@category,name,price.@currency,price
101,office,Keyboard,USD,49.99Invalid XML is the most common failure: mismatched or missing closing tags, more than one root element, a malformed declaration, or a reference to an entity the document never declares. The converter parses the document with a real XML parser before anything is written, so these problems surface as an error with a line and column - never as broken CSV.
Uneven records are the second: two <product> elements with different fields produce a union of columns, with empty cells where a record has nothing to say. That keeps every value in its own column rather than shifting rows out of alignment.
The third is structure that does not fit a table at all. Repeated children inside one record are joined into one cell, deeply nested subtrees are joined the same way, and sibling elements that are not part of the repeated records are left out with a warning. CSV is inherently flat, so a tree has to be reshaped; the tool reports every reshape it makes instead of hiding it.
Converting makes sense when the next step is a table: reviewing an XML export in Excel or Google Sheets, preparing data for a CSV-compatible import, checking product or inventory records by eye, or analyzing repeated records from an XML API response in a pivot table.
It is the wrong tool when the document's value is its hierarchy - deep nesting, mixed content models, or schemas where every record legitimately has a different shape. Those documents are better kept as XML or converted to JSON with the XML to JSON converter, which preserves the tree exactly. For record-shaped data destined for a spreadsheet, though, XML to CSV is usually the shortest path.
Common questions about this tool