CSV ↔ XML Converter.
Convert CSV rows into XML elements and flatten repeated XML records back into a CSV table.
Runs in your browserAbout CSV ↔ XML Converter
The CSV ↔ XML Converter maps a table to XML records and back. In the CSV to XML direction each row becomes a row element and each column becomes a child element named after its header, inside a root element you can name yourself, for example <products><product><id>1</id>…</product></products>. Header names that are not valid XML names are repaired: spaces and punctuation become underscores and names that start with a digit get a leading underscore, so "full name" becomes <full_name> and "1st" becomes <_1st>. Special characters such as &, < and > in values are escaped, and empty cells become self-closing elements. The CSV parser follows RFC 4180, so quoted fields with commas, quotes or line breaks are read correctly, and the delimiter can be detected or chosen. In the XML to CSV direction the converter looks for the repeated record elements under the root, also when they are wrapped in one extra container such as <export><items><item>. Attributes and child elements both become columns, the column set is the union of all records in order of first appearance, missing values stay empty, and a child that repeats inside one record gets a numbered column. Nested structures deeper than one level are flattened to their text. Malformed XML, such as a missing closing tag or a bare ampersand, is reported with the line and column. All work happens in your browser.
How to Use
- Paste CSV or XML and choose the direction.
- Name the root and row elements, or pick the CSV delimiter.
- Copy or download the converted output.
Frequently Asked Questions
How are column names turned into element names?
Characters that XML names cannot contain become underscores, and a name that starts with a digit or with "xml" gets a leading underscore. "unit price" becomes <unit_price>.
Which elements become rows when converting XML to CSV?
The element children of the root. If the root only wraps a single container, its children are used instead, so both <items><item> and <export><items><item> work.
Are attributes exported?
Yes. Each attribute of a record element becomes a column next to the child elements.
Does the data leave my computer?
No. Parsing and conversion run in your browser.
Related Tools
Convert JSON to XML and XML back to JSON, with attributes, repeated elements and CDATA handled.
Format, minify, and validate XML.
Convert between CSV and JSON formats.
Edit CSV files in a spreadsheet-style grid, right in your browser.
Turn CSV rows into SQL INSERT statements for four dialects, or export INSERT statements as CSV.
Convert between HEX, RGB, and HSL formats.