How to use CSV to XML
- Paste your CSV into the input box, or click Open a file to load a .csv file.
- Leave the delimiter on Auto-detect, or pick comma, semicolon or tab. Optionally rename the root and row elements.
- Read the XML in the output box.
- Click Copy or Download to save data.xml.
Features
- First row becomes the element names; invalid name characters become underscores
- Duplicate headers are made unique (name, name_2)
- Quoted fields with commas, quotes and line breaks are read correctly (RFC 4180)
- Choose the delimiter, root and row element names, and indentation
- Runs in your browser, so the CSV is never uploaded
Supported formats and limits
- Maximum input: 10,000,000 characters
Examples
| Input | Result |
|---|---|
| name,age Ana,30 "Luis, Jr.",41 | <?xml version="1.0" encoding="UTF-8"?> <rows> <row> <name>Ana</name> <age>30</age> </row> <row> <name>Luis, Jr.</name> <age>41</age> </row> </rows> |
| first name;age Ana;30 | <?xml version="1.0" encoding="UTF-8"?> <people> <person> <first_name>Ana</first_name> <age>30</age> </person> </people> — Semicolon delimiter, root "people", row "person". |
Limitations
- The first row is always treated as the header. A file without a header row will use its first data row as element names.
- All values are written as text; XML has no number or date types.
- There are no XML attributes in the output, only elements.
Learn more
CSV is a simple table format: one record per line and fields separated by a delimiter, usually a comma. XML is a tree of named elements. To turn a table into a tree you need names, which is why the first row of the CSV, the header, is used to name the child elements of every record.
Some care is needed because XML names are stricter than CSV headings. A name cannot contain spaces, cannot start with a digit and cannot be empty, so headings are cleaned up: spaces become underscores, a leading digit gets an underscore in front, and repeated headings get a number. Values are escaped so characters such as & and < cannot break the document.
The structure produced is a root element holding one row element per record. Systems that expect a different layout, for example with attributes, may need a further transformation such as XSLT.
Frequently asked questions
Which row is used for the element names?
The first row. Each header becomes an element name; spaces and other invalid characters are replaced with underscores.
Can I use a semicolon or tab delimiter?
Yes. Leave Auto-detect on, or choose comma, semicolon or tab yourself.
Are commas inside quoted fields handled?
Yes. Fields in double quotes can contain the delimiter, doubled quotes and line breaks.
Is my CSV uploaded?
No. The conversion runs in your browser.
Sources
- RFC 4180, Common Format and MIME Type for CSV Files
- Extensible Markup Language (XML) 1.0, W3C Recommendation
Last reviewed: September 30, 2026