DevToolPal
EN

XML to CSV Converter

Convert repeated XML records into CSV rows, with attributes and nested elements as columns.

Runs locally, never uploaded

Options

Input

0 chars · 0 B

Output

0 chars · 0 B

What it does

This tool converts XML data into CSV. It finds the repeated records in the document, such as every <user> inside <users>, and writes one CSV row per record. Child elements and attributes become columns, nested elements are flattened into dotted column names, and every row gets the same set of columns.

How to use

  1. Paste XML into the Input box, upload an .xml file, or click Sample.
  2. The CSV appears on the right as you type. Broken XML is reported with its line and column.
  3. Choose the output Delimiter and whether to Include header row.
  4. Copy the CSV or download it as a .csv file.

Example

<users>
  <user id="1"><name>Alice</name><address><city>Shanghai</city></address></user>
  <user id="2"><name>Bob</name><address><city>Beijing, China</city></address></user>
</users>

becomes

name,address.city,id
Alice,Shanghai,1
Bob,"Beijing, China",2

Notes

Cells that contain the delimiter, quotes or line breaks are quoted following RFC 4180. Values are kept as text exactly as they appear in the XML, so leading zeros are not lost.

FAQ

› Which elements become rows?

The repeated child elements of the root, for example every <user> inside <users>. If the root has a single child element, that element becomes the only row.

› What happens to attributes and nested elements?

Attributes become columns named after the attribute (id="1" → id). Nested elements become dotted columns such as address.city. Repeated simple values are joined with "; ".

› Why is a column named @id instead of id?

When an attribute and a child element have the same name, the attribute keeps its @ prefix so the two columns stay apart.

› Can I open the result in Excel?

Yes. Download the .csv file and open it, or choose the semicolon delimiter if your Excel uses a comma as the decimal separator.