Skip to main content

XML to CSV Converter

Paste XML or drop a file — get clean, spreadsheet-ready CSV instantly. Nested elements flatten to dotted columns, attributes become @attr columns, and repeating elements become rows. Free, no signup.

100% client-side — your XML never leaves your browser One direction: XML → CSV

1. Your XML

0 bytes

2. Conversion options

Tip: the row dropdown appears after your first successful conversion.

3. CSV result

Convert some XML to see the preview.

How XML becomes CSV

  • Rows: the outermost repeating element is auto-detected — each <book> in a catalog becomes one row. Override it with the Row element dropdown.
  • Nested elements: flattened with dot notation — address.city, order.item.0.sku.
  • Attributes: become @attr columns (price@currency). Change or drop the prefix in options.
  • Repeated children: indexed columns (phone.0, phone.1) or joined into one cell.
  • Mixed text: text sitting next to child elements lands in a #text column.
  • Namespaces: prefixes like bk: are stripped by default; keep them to avoid name collisions.
  • Quoting: RFC 4180 — fields containing the delimiter, quotes or newlines are quoted, inner quotes doubled.
  • Column union: every distinct column across all rows appears; missing values stay empty.

XML to CSV — frequently asked questions

How are nested XML elements converted to CSV columns?

Nested elements are flattened with dot notation: <address><city>Boston</city></address> becomes a column named address.city. Each nesting level adds another dotted segment, so an order with two items produces item.0.sku and item.1.sku. This keeps every value addressable in a flat table without losing the hierarchy.

How are XML attributes represented in the CSV output?

Attributes become their own columns prefixed with @ by default. <book id="bk101" lang="en"><title>Dune</title></book> produces @id, @lang and title columns. An attribute on a nested element joins the dotted path, so <price currency="USD">44.95</price> yields price and price@currency. You can change the prefix to attr_ or remove it in the options.

How does the tool decide which XML elements become CSV rows?

It auto-detects the outermost repeating element: in a catalog of <book> entries, each book becomes one row. If your document has several repeating groups, use the Row element dropdown to pick a different one, for example line items instead of orders. Documents with no repeating elements are converted as a single row.

How are XML namespaces handled?

Namespace prefixes are stripped by default, so <bk:title> becomes a plain title column. Turn off Strip namespace prefixes to keep them, which gives bk:title and avoids collisions when two namespaces define the same local name. The namespace URIs themselves are never added as columns.

What happens to CDATA sections and special characters?

CDATA content is treated as ordinary text, so <![CDATA[a <b> & quote]]> lands in the cell exactly as written. Values containing the delimiter, quotes or line breaks are quoted following RFC 4180, with inner quotes doubled. Mixed content such as text around child elements goes to a #text column.

How do I open the converted CSV in Excel without garbled characters?

Keep UTF-8 BOM and CRLF line endings enabled; both are on by default. The BOM tells Excel the file is UTF-8 so accented characters display correctly, and CRLF matches what Excel expects on Windows. If your locale uses semicolons in Excel, pick the semicolon delimiter before downloading.

Is my XML data uploaded to any server?

No. Conversion runs entirely in your browser with JavaScript: your XML is parsed locally with DOMParser, never sent over the network, and there is no account or signup. You can even disconnect from the internet after the page loads and keep converting.

Can I convert a large XML file?

Yes, within browser memory limits. Files of a few megabytes convert instantly; tens of megabytes work but may take a few seconds. The preview shows the first 50 rows to stay fast, while Download exports every row. For very large feeds, selecting the repeating row element explicitly avoids surprises.

What should I do if my XML has a syntax error?

The tool shows the exact line and column reported by the parser, for example Invalid XML at line 4, column 18. Common causes are unclosed tags, unescaped & characters and mismatched quotes on attributes. Fix the reported spot and convert again, or validate the document first with our XML validator.

How do I convert CSV back to XML?

This tool converts one direction only, XML to CSV, which keeps the mapping rules predictable. To go the other way, use our CSV to XML converter, which rebuilds tagged markup from tabular rows.

Free tool by NRTechStudio