Dad’s Data formats tools

XML → CSV Converter

Convert XML to CSV locally. The root must contain repeating elements; attributes are flattened to columns.

XML Input
CSV Output

CSV output will appear here.

Paste, upload, or drop a file in the input panel to get started.

Required XML structure

CSV is a flat, tabular format. The converter routes through JSON as an intermediate step, so it expects your XML to have a repeating element pattern — a root element containing multiple sibling elements of the same tag, each with the same set of child elements. Those child element names become CSV column headers.

Input
<?xml version="1.0"?>
<users>
  <user>
    <id>1</id>
    <name>Alice</name>
    <city>Paris</city>
  </user>
  <user>
    <id>2</id>
    <name>Bob</name>
    <city>London</city>
  </user>
</users>
Output
id,name,city
1,Alice,Paris
2,Bob,London

Attribute handling

XML attributes on row elements are flattened into CSV columns alongside child element values. If both an attribute and a child element share the same name, the child element value is used.

Input
<products>
  <product id="p1" category="books">
    <name>TypeScript Deep Dive</name>
    <price>29.99</price>
  </product>
</products>
Output
id,category,name,price
p1,books,TypeScript Deep Dive,29.99
Warning: Deeply nested XML (elements inside elements) cannot be represented as flat CSV columns. Nested child elements will be serialised as JSON strings in the CSV cell. Flatten your XML structure first if you need clean tabular output.

Column and value rules

XML constructCSV columnNotes
Child element textColumn valueDirect text content
AttributeColumn valueFlattened alongside children
Empty element <x/>(empty cell)Self-closing → empty string
Nested child element(serialised JSON)Flatten first for clean output
CDATAPlain textMarkup stripped
Mixed contentCombined textText nodes joined
Namespace prefixPrefix droppedLocal name used as column header

Frequently Asked Questions

Your files stay on your computer. Dad promised.

Data formats tools

Search the Data formats tools