1. Home
  2. Spreadsheets & Data
  3. XML to CSV Converter

XML to CSV Converter

Turn repeating XML elements into CSV rows, or build XML from CSV.

Runs in your browser · No upload
Columns and order
Rows
3
Columns
7
Preview (first 100 rows)
@idtitlelinkpubDatecategory[1]category[2]dc:creator
101Spring workshophttps://example.com/news/1012024-03-04EventsNoticeJane Doe
102Meet our new hireshttps://example.com/news/1022024-03-11PeopleJohn Smith
103Maintenance & schedulehttps://example.com/news/1032024-03-18NoticeITAnn Lee
Preview (first 3 rows)

XML and CSV are processed in this browser and never uploaded.

How to use

  1. XML → CSV: paste XML or drop an .xml file. A sample RSS feed is preloaded so you can see a result right away.
  2. Pick the repeating element that should become one row each. The most repeated path comes first (for example /rss/channel/item).
  3. Choose how deep to flatten, how to handle names that repeat, and whether to strip namespace prefixes.
  4. Untick columns you do not need and reorder the rest with the arrows. Check the preview (first 100 rows).
  5. Click Save CSV, Save XLSX, or Open in workbench to keep cleaning the table.
  6. CSV → XML: switch the direction, paste CSV, and set the root and row names, which columns become attributes, and the indent.

Options

Option What it does
Repeating element Each element at the chosen path becomes one row. Up to 5 candidates, ranked by how often the same name repeats under one parent
Flatten depth 1 = children only, 2 = grandchildren too (author/name), 3 = great-grandchildren. Anything below the limit is joined into one cell as text
Split columns A name that appears several times in a record becomes category[1], category[2]. If it repeats in any record, every row uses the same format
Join in one cell Joins the values with ; into a single category column
Remove namespaces dc:creator → creator
Write as attributes In CSV → XML, ticked columns become attributes like <row id="1">; the rest become child elements

Why repeating elements become rows

XML is a tree and CSV is a flat table, so you have to decide which element counts as “one line”. Elements that repeat with the same shape (<item>, <book>, <row>) are usually one record each, so the tool makes them rows and spreads attributes (@id) and child elements into columns.

Government open-data API responses are the classic case. In the response below, /response/body/items/item is detected first and gives 2 rows.

<response><header><resultCode>00</resultCode></header>
<body><items>
  <item id="1"><name>A</name><addr><city>Seoul</city><zip>04524</zip></addr></item>
  <item id="2"><name>B &amp; C</name><addr><city>Busan</city></addr></item>
</items><total>2</total></body></response>
@id name addr/city addr/zip
1 A Seoul 04524
2 B & C Busan (empty)

With depth 1, addr becomes a single column holding the text, Seoul 04524 and Busan.

Good to know

  • Deep structures do not fit a flat table perfectly. If a repeating element contains another repeating list (order lines inside an order), you get extra columns (item[1], …) or one joined cell. To get the inner list as rows, choose the inner path and convert again.
  • Columns are created in the order they first appear. A value missing from a row is an empty cell.
  • The parser does not process DTDs or external entities, so XXE attacks that try to pull in files or URLs have nothing to work with. Only the basic entities (&lt;, &amp;, …), numeric references and CDATA are decoded.
  • Values starting with = or @ could be run as formulas by Excel, so the CSV download prefixes them with '.
  • In CSV → XML, column names are adjusted to XML naming rules: spaces and symbols become _, and a leading digit gets a _ in front (1st col → _1st_col). Non-Latin names such as Korean are kept.
  • Input up to 5 MB is supported.

Related tools: Excel & CSV Workbench, JSON to CSV Converter, XML Formatter, HTML Table to CSV

Your text and files are processed only in this browser and are never sent to a server.

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.