Home › File & PDF Tools › XML to CSV Converter

XML to CSV Converter

This free XML to CSV converter turns XML data into a spreadsheet-ready CSV table in your browser. Paste your XML or upload a .xml file, press Convert, and get a clean CSV you can copy, download, or open straight in Excel or Google Sheets — with a preview table so you can check the result before you save it. Everything happens on your own device: nothing is uploaded to any server, so exports, feeds, and private records stay private.

Your CSV will appear here
Paste XML above and press Convert to CSV.

How it works

XML and CSV describe the same kind of data — a list of records with named fields — but in opposite shapes. XML is nested: each record is wrapped in tags, and fields sit inside the record like boxes inside boxes. CSV is flat: one record per line, fields separated by commas, with an optional header row naming the columns. A spreadsheet cannot read the nested shape directly, which is why exports from old systems, feeds, and APIs so often arrive as XML that needs flattening first. This converter does that flattening for you, in your browser, and shows you a preview table before you download anything.

The conversion follows one clear rule: each repeated child element under the root becomes one row. In an <orders> document, every <order> becomes a row, and the fields inside it — id, item, price — become the columns. The header row lists those column names, and every row fills in its own values in the same order, so the table lines up even when some records are missing a field: a missing field simply becomes an empty cell. If the root has no repeated children — a single <customer> with a name and an email, for example — the root itself becomes one row, so you still get a proper CSV with a header and one data row.

Nested elements are flattened with dot paths instead of being dropped. If an order contains an <address> with a <city> inside it, the output gets a column called address.city, so the city value survives and you can still tell which group it belonged to. Attributes are kept too, when the option is on: an element such as <order status="paid"> adds a column called @status with the value "paid". When an element repeats inside a single record — two <tag> values, for instance — the values are joined with a semicolon in one cell, so nothing is lost and the row count stays correct.

The CSV itself follows the usual rules, and the options let you match the tool you are sending it to. A comma is the default delimiter and works in Excel, Google Sheets, and most databases. Choose a semicolon if your numbers use commas as decimal separators, as in many European locales, or a tab if the destination expects tab-separated values. Quote style matters when a value contains the delimiter itself: "Quote only when needed" wraps just those fields in double quotes, which is the standard behaviour; "Always quote" wraps every field, which some strict importers prefer; "Never quote" leaves values bare, which is fine for simple data but can break a row if a value contains a comma. Double quotes inside a value are doubled, as the CSV standard requires, so say "hi" becomes "say ""hi""" and imports correctly.

The converter also validates your XML while it works, which makes it useful as a quick XML checker even when you do not need the CSV at all. XML is strict: every opening tag needs a matching closing tag, tags must nest in the right order, and one root element must wrap everything. If any of those rules is broken, the conversion stops and the error line shows the parser's own message, which usually names the line where the problem is. Fix that spot and convert again. Common culprits are an unescaped & in text — write &amp; instead — and a missing closing tag after a long block of copied XML.

A few honest limits. This tool is built for record-shaped XML — lists of similar items — which covers orders, products, customers, feeds, and exports. It is not the right shape for deeply mixed documents, such as a book chapter with paragraphs and inline formatting, where flattening would lose the structure that matters. Very large files, tens of megabytes of XML, may be slow in a browser tab; for those, a command-line tool is a better fit. And because the output is plain text, any formatting, colours, or formulas from the original system are not carried over — CSV holds data, not presentation. For the everyday job of turning an XML export into a spreadsheet, this page is the fastest route — and because it runs entirely in your browser, you can use it on private data without a second thought.

Worked example

A shop owner exports two orders as XML and needs them in a spreadsheet:

Step 1: Paste the XML into the input box:
<orders><order><id>1</id><item>Book</item><price>12.99</price></order><order><id>2</id><item>Pen</item><price>1.50</price></order></orders>
Step 2: Press Convert to CSV with a comma delimiter, header row on, and quote-when-needed.

The validation line reports Valid XML — converted to CSV successfully, and the output is:

id,item,price
1,Book,12.99
2,Pen,1.50

That is exactly the CSV the tool produces for this input — two data rows under one header row, with the price 1.50 kept as written. The preview table shows the same three columns, the owner copies the CSV into a spreadsheet, and the orders are ready to sort, filter, and total. Try adding a third order, or a nested <address><city>Austin</city></address> inside one order, and watch a new row — or a new address.city column — appear in the preview.

FAQ

Is my XML uploaded anywhere?

No. The conversion runs entirely in your browser using the built-in XML parser. Your data never leaves your device, so private exports, feeds, and config files stay private.

How does XML become rows and columns?

Each repeated child element under the root becomes one row, and each field inside it becomes a column. Nested elements are flattened with dot paths, so address.city becomes its own column instead of being lost.

What if my XML has only one record?

If the root has no repeated children, the root itself becomes a single row, with each of its fields as a column. You still get a proper CSV with a header row and one data row.

Why does it say my XML is invalid?

The most common causes are a missing closing tag, tags closed in the wrong order, or more than one root element. The error message shows the parser's own message, which usually names the line where the problem is — fix that spot and convert again.

Which delimiter should I choose?

Use a comma for most spreadsheets, including Excel and Google Sheets. Use a semicolon if your data uses commas as decimal separators, as in many European locales. Use a tab if you are pasting the result into a plain-text table or a tool that expects tab-separated values.