Converters
XML to CSV Converter
Turn record-style XML into spreadsheet-ready rows — wrapper elements unwrapped, nested fields flattened to columns.
In short
Convert XML to CSV online: record-style XML becomes spreadsheet rows with flattened columns and proper quoting. Validates the XML first. Free, private.
By NaveenKumar T · Updated
- Instant in-browser conversion
- Validates input first
- Auto-unwraps root wrapper elements
Runs entirely in your browser — nothing you paste or open here is uploaded, logged, or stored.How we handle data →
Example
XML to CSV: input and output
A staff directory: repeated <employee> records with an id attribute, a nested <contact> block, a repeated <skill> element and a name containing a comma. No declaration and no root attributes, so the wrapper unwraps cleanly.
<staff>
<employee id="e-17">
<name>Mei Tanaka</name>
<contact><email>mei@example.com</email><phone>+81 3 5555 0140</phone></contact>
<skills><skill>Go</skill><skill>SQL</skill></skills>
</employee>
<employee id="e-23">
<name>Diego Ruiz, Jr.</name>
<contact><email>diego@example.com</email></contact>
<remote>true</remote>
</employee>
</staff>name,contact.email,contact.phone,skills.skill.0,skills.skill.1,@id,remote
Mei Tanaka,mei@example.com,+81 3 5555 0140,Go,SQL,e-17,
"Diego Ruiz, Jr.",diego@example.com,,,,e-23,trueThe <staff> wrapper was unwrapped so each <employee> is one row. contact.email and skills.skill.0 are dot-path columns, the id attribute became an @id column placed after the element-derived columns, the name containing a comma was quoted, and Mei's row leaves the remote cell empty because her record has no such element.
Learn more
How XML to CSV conversion works
The XML is parsed to a structured tree, single-key wrapper elements (like a lone root around a list) are unwrapped automatically, and repeated records become rows. Within each record, nested elements flatten to dot-path columns and attributes appear as @-prefixed columns, so nothing silently disappears.
Quoting follows RFC 4180 — values containing commas, quotes or line breaks are escaped correctly for Excel, Google Sheets, and database importers.
When to convert XML to CSV
Most XML-to-CSV jobs are exactly this shape: a system hands you <records><record>…</record>…</records> and someone needs it in Excel. This converter handles the parse, unwrap, flatten, and escape steps that make hand-conversion tedious, and it's equally handy as the first stage of loading XML exports into SQL tables.
Help
Frequently asked questions
Everything you need to know about the XML to CSV.
01Are XML attributes included as CSV columns?
XML attributes appear in the CSV as their own @-prefixed columns, sitting alongside columns built from child elements, so an attribute named id on a repeated record element becomes an @id column no different in kind from any other column — only the prefix marks where it came from.
02Which XML shapes convert well to CSV?
Lists of similar records — repeated elements with mostly scalar children — convert beautifully. Deeply hierarchical, document-style XML (think DocBook or HTML) doesn't have a natural tabular form: it will still convert via flattening, but expect very wide rows. For those, XML to JSON is usually the better target.
03Why did I get one very wide row instead of one row per record?
The converter unwraps the root only while each level is a single-key object. Anything sitting beside the record list counts as a second key and stops the unwrap: an attribute on the root (<staff updated="2026-06-01">), a sibling element such as a <title>, or the <?xml …?> declaration itself, which parses as a ?xml key. The whole document then flattens into a single row with columns like employee.0.name, employee.1.name. Remove the declaration and root attributes, or paste just the list, to get one row per record.
04Does converting back with CSV to XML reproduce the original element names?
CSV to XML always wraps rows in a fixed <rows>/<row> structure with your column headers as the child element names, so <employee id="e-17"> becomes <row><id>e-17</id>…</row> instead of reappearing as <employee>. The data survives the round trip; the original tag vocabulary does not.
Keep working
Related tools
CSV to XML
Converters
XML to JSON
Converters
XML Parser
Run a real XML parse in your browser — see the structure parsers produce, or exactly where they fail.
JSON to CSV
Converters
XML to YAML
Converters
XML Formatter
Re-indent any XML document into clean, readable markup — comments and CDATA preserved, validation built in.
Learn the format
Related guides
XML Tutorial: Structure, Syntax & Survival Skills
A working developer's XML tutorial: elements, attributes, namespaces, escaping, and well-formedness rules — with the errors that actually break parsers.
2 min readGuide · Data FormatsWhat is a CSV File? The Format Everyone Uses and Nobody Reads About
CSV explained properly: the RFC 4180 rules, how quoting really works, why Excel mangles your data, and when CSV beats JSON (and when it doesn't).
2 min read