XML to CSV Converter
XML to CSV: each child of the root element becomes a row, its tags become columns and attributes @ columns, with a comma, semicolon, tab or pipe delimiter. How it works
Use the XML to CSV Converter
About the XML to CSV Converter
To convert XML to CSV, each child element of the root becomes one row, each tag inside it becomes a column, and each attribute becomes a column named with @. Two <person> records with <name>, <age> and <city> and an id attribute give two rows such as John Smith,30,New York,1. Nested elements are not split into their own columns: their text is joined into one cell, unless you set a Record path such as orders/order/addr, which makes every matching element a row.
How to use this tool
- Paste the XML into XML Input, drop a .xml or .txt file on the upload area, or press Load Sample.
- For nested XML, type a Record path such as catalog/item: each matching element becomes a row. A bare name matches at any depth, and a leading / starts at the root.
- Pick the delimiter (comma, semicolon, tab or pipe) and the quote character, and choose whether to include the header row.
- Check the Structure Preview: root element, data rows, columns and the column names.
- Copy the CSV, or download it as a .csv file named after the root element.
Frequently asked questions
- How do I open the CSV in Excel?
- Download it and open it, or in Excel use Data, From Text/CSV and pick the file. If your Excel expects semicolons (common where the decimal separator is a comma), choose Semicolon before downloading. The download starts with a UTF-8 byte-order mark, so Excel reads accented letters correctly when you open it. Text you copy and paste has no mark; if accents look wrong after pasting it into a file, import that file through From Text/CSV and set the file origin to UTF-8.
- Why do some cells start with an apostrophe?
- A cell that starts with =, + or @, or with a minus followed by a letter or one of ( = + - @, could run as a formula when a spreadsheet opens the file. The converter puts an apostrophe in front of such a cell, so -A1 and +1 are written with a leading apostrophe. A plain negative number such as -5 is left alone.
- What happens to repeated child elements?
- Only the first one with a given name is kept in the row. If an order has three <item> elements, the item column holds the first. To get every item, set the record path to item (or orders/order/item): each <item> becomes its own row, although that row has no columns from its order.
- Does it handle namespaces?
- Yes, when the prefix is declared, as in a Google Shopping feed with xmlns:g on the root: <g:price> becomes a column called g:price. A prefix that is used but never declared makes the XML invalid, and the converter shows an error instead of output.
- Is there a size limit?
- The Max rows field converts up to 100,000 rows, 1,000 by default, and warns when the XML has more. XML longer than 5 million characters is refused with a message. The whole document is parsed in the browser tab, so a large file can make the page slow.
Related Tools
View all toolsCSV to JSON
Convert CSV to JSON: the first row becomes the keys, quoted commas and line breaks are kept, and numbers and booleans are detected only if you ask.
JSON to CSV
Turn JSON into CSV: an array of objects, one object or a list of values. Flatten nested objects, expand arrays into rows, then copy or download.
XML to JSON Converter
Convert XML to JSON and JSON back to XML: attributes go under @attributes, repeated elements become arrays, and an XML error shows its line and column.
YAML to JSON Converter
Convert YAML to JSON with anchors and merge keys resolved, YAML 1.2 or 1.1 typing for yes/no, and a warning for numbers JSON cannot hold.
JSON to YAML
Convert JSON to YAML in block or flow style. Text such as yes or 017 is quoted so it stays a string, and a JSON error shows its line and column.
SQL to JSON
Turn SQL INSERT statements, or a result table pasted from psql, MySQL or Markdown, into JSON. Quoted values stay strings; numbers, true and NULL get types.