Skip to main content
Convert2JSON Tools

XML to CSV Converter

Flatten a repeating XML structure — a product feed, an export, an RSS list — into rows you can open in a spreadsheet.

Your data stays on your device

Input — XML

characters
0
lines
0
size
0 B

Output — CSV

characters
0
lines
0
size
0 B

Options

Needed for Excel to open non-ASCII text correctly.

About this tool

Most XML that people need as CSV has the same shape: a container element holding many similar child elements, each representing one record. The conversion finds that repeating group, treats each occurrence as a row, and derives columns from the leaf paths inside it.

Attributes are included as columns alongside element values, so nothing from the source is silently dropped. Because records in XML often omit optional elements, the column set is the union across all records and missing values are left blank.

How to use this tool

  1. Paste XML or upload a .xml file.
  2. Confirm the detected record element, or set it manually if the structure is unusual.
  3. Pick the delimiter and decide whether to include attributes as columns.
  4. Press Convert and download the CSV.

Key features

  • Automatic detection of the repeating record element
  • Columns derived from dotted leaf paths within each record
  • Attributes included as their own columns
  • Comma, semicolon, tab and pipe delimiters
  • RFC 4180 quoting for values containing separators or newlines
  • Optional UTF-8 BOM for spreadsheet compatibility

Example

A repeating record element becomes rows

InputXML

<items>
  <item id="1"><name>Cable</name><qty>2</qty></item>
  <item id="2"><name>Hub</name><qty>1</qty></item>
</items>

OutputCSV

@id,name,qty
1,Cable,2
2,Hub,1

Good to know

  • XML that is not record-shaped — a deep, irregular tree with no repeating group — has no natural table form and will produce a single wide row.
  • Mixed content, where an element contains both text and child elements, flattens imperfectly.
  • Comments, processing instructions and namespace declarations are not carried into the CSV.

Frequently asked questions

How does it decide what a row is?

By finding the deepest element that repeats as a sibling under a common parent. That is almost always the record boundary in feeds and exports. You can override it if the guess is wrong.

Are attributes included?

Yes, as columns prefixed with @, unless you disable them. Attributes frequently hold identifiers, so dropping them by default would lose important data.

What if records have different fields?

The header contains every column seen anywhere in the document, and records lacking a field get an empty cell.

Can I convert only part of the document?

Set the record element explicitly to the subtree you care about and everything outside it is ignored.

Your data stays on your device

Your data is processed locally in your browser and is not uploaded to our server. This page keeps working after you go offline, because there is nothing to send.

Share this toolXLinkedInHacker News