Data
XML to CSV Converter
Flatten XML records into CSV for spreadsheets and reports: one row per record, attributes and fields as columns.
Written by Jay Sudha · Published · Last updated
Press ⌘ Enter to run
5 lines · 194 chars
Ready; press Run or ⌘ Enter
How this tool handles files
- Processing
- In your browser, on-device
- Storage
- Nothing stored
- Output
- A file you download
- Your responsibility
- Review before official use
- Runs in your browser. Your file is processed on your own device and, on this site, is not uploaded to our servers.
- Nothing is stored. Your file and its output are gone the moment you close or reload the page.
- Review sensitive files (bank, ID, medical) and check the output before sharing it.
Every tool on FormatOS runs in your browser. Read our Privacy Policy and File Handling Policy.
Common uses
- Turn XML records into spreadsheet rows
- Bridge legacy XML to modern tools
Limitations
- Deeply nested records produce long path-named columns (address.city)
Where this converter earns its place
The XML to CSV Converter is for one common situation: you have XML records and you need them as spreadsheet rows. That covers a developer pulling a sample API response or export into a table for review, an analyst loading an XML feed of orders, products or contacts into Excel or a database staging table, and an admin who received an XML export from an older system and needs columns they can read.
Because everything runs in your browser, it is also a reasonable choice for data you would rather not upload anywhere: internal exports, draft records, anything mid-pipeline. The file is parsed locally, and nothing persists once the tab is closed.
How records become rows and columns
Paste XML, open an .xml file or drop one on the input, then run it. The document is parsed strictly, so a missing end tag, a bare & or a second root element stops the run with the line, the column and the reason instead of a partial table.
The converter then looks for the record: the element that repeats most often directly under the root. Each record becomes a row. Its attributes become columns such as @id, its simple child elements become columns named after them, and deeper fields are named by their path, such as address.city. When a field repeats inside one record, the extra values get numbered columns (tag, tag_2) rather than being merged.
Standard CSV escaping is applied: values containing commas, quotes or line breaks are wrapped in double quotes with embedded quotes doubled, so the file opens cleanly in any spreadsheet. If the XML has no repeating element, the whole document becomes one row.
What to watch for
Records that differ in shape produce sparse columns. If one <order> has a <coupon> and the others do not, there is a coupon column that is empty for most rows, which is correct but worth recognising.
Very deep XML gives long path-named columns. That keeps every value, but if you only need a few fields, delete the other columns in your spreadsheet rather than trying to reshape the XML.
Every value comes across as text. A spreadsheet may reinterpret numbers, dates and identifiers when it opens the file, so a code like 00123 can lose its zeros on import unless you mark that column as text.
Check the table before you rely on it
Compare the row count with the number of records in the XML, and confirm the headers match the fields you expected, including any attributes you know carry data.
Scan for numbered columns such as tag_2: they show where a field repeated inside a record, which may mean the XML holds a list you want as separate rows.
For anything official or financial (invoices, statements, accounting or regulatory records), treat the CSV as a working copy and verify key fields and totals against the original XML.
Frequently asked questions
The element that repeats most often directly under the root is treated as the record, so <orders><order>…</order><order>…</order></orders> gives one row per <order>. If nothing repeats, the whole document becomes a single row.
Nested fields become columns named by their path, such as address.city. A field that repeats inside one record gets numbered columns (phone, phone_2), so nothing is merged or dropped.
Yes. An attribute on the record becomes a column such as @id, and an attribute on a nested element is named by its path, such as price@currency.
No. The conversion runs in your browser; your text or file is processed on your own device and, on this site, is not uploaded to a server, and we do not intentionally store it.
Related data tools
Tool last reviewed: September 27, 2026 · Report a problem