Open or paste a CSV file and get well-formed XML: a root element, one row element per record, and each value as a child element or an attribute. Headers that are not legal XML names, such as Order ID or 2024 total, are renamed and every rename is listed. The file is converted in your browser and never uploaded.
How to convert CSV to XML
- Select Open file, drop a
.csv,.tsvor.txtfile on the tool, or choose Paste. Check the delimiter and encoding under Import settings if the columns look wrong. - Name the Root element and Row element (
rowsandrowby default) to match what the receiving system expects. - Choose Values as, empty-value handling, Indentation and the declaration, then select Copy or Download XML.
If the system reading the file expects specific tag names, rename the CSV columns first with Map CSV columns so no automatic renaming is needed.
What each option does
| Child elements | The default: <row><Customer>Smith & Sons</Customer>…</row>. Keeps line breaks in values and suits most import tools. |
|---|---|
| Attributes | One self-closing element per row: <row Customer="Smith & Sons" …/>. Compact; tabs and line breaks in values are written as 	, and so a parser keeps them. |
| Leave out empty values | Off by default, so an empty cell becomes an empty element such as <Ship_date/>. On, the element or attribute is left out of that row. |
| Indentation | 2 spaces (default), 4 spaces, or None (minified), which writes the whole document on one line. |
| Add the XML declaration | On by default: the first line is <?xml version="1.0" encoding="UTF-8"?>. Turn it off when the XML will be embedded in another document. |
The root and row names go through the same name rules as headers; a blank or invalid entry falls back to rows or row, or gets an underscore prefix.
How column names become XML names
- Spaces become
_and any character other than letters, digits,.,-and_becomes_:Total (EUR)→Total__EUR_,e-mail:work→e-mail_work. Colons are replaced, so no namespace prefixes are created. - A name that starts with a digit,
.or-gets a leading underscore (2024 total→_2024_total); so does a name starting withxmlin any case, which XML reserves (xml_ref→_xml_ref). - If two headers end up with the same name, the second gets
_2(a banda_b→a_b,a_b_2). XML names are case-sensitive, soNameandnamestay distinct. - Letters from any script are kept:
Größeand価格are valid XML names. A blank header first becomesColumn 7, thenColumn_7. - Every rename is listed under the options as
old → new, and a notice above the preview gives the count.
How values are written
&,<and>are escaped in element text; attributes also escape". Values are otherwise written exactly as in the CSV:00731keeps its zeros and no type is guessed.- XML 1.0 forbids most control characters (U+0000–U+001F except tab, line feed and carriage return), U+FFFE, U+FFFF and unpaired surrogates even when escaped. They are removed and the number of affected values is shown.
- Quoted commas, quotes and line breaks are read per RFC 4180; a line break stays a real line break inside a child element.
- The output is always UTF-8.
Troubleshooting
- My import tool cannot find a field. It was probably renamed. Check the list under the options and rename the column in the CSV or adjust the mapping in the receiving system.
- A parser reports an encoding error. Open the source file with its real encoding under Import settings; the XML is UTF-8 only if the CSV was decoded correctly.
- Everything is in one element. The delimiter was guessed wrong; set Comma, Semicolon, Tab or Pipe under Import settings.
- I need CDATA, namespaces or a schema. The converter writes plain elements and attributes only; add those in a later step.
Limits and privacy
Files up to 25 MB, 100,000 rows or 2 million cells open with a live preview of the first 200 rows. Larger files are converted in streaming mode: the file is read twice in chunks (once to measure the columns, once to write), a notice says the download covers the whole file, and Copy is not offered. A single output file is capped at 4 GB.
The conversion runs in a background worker in this tab, so the page stays responsive and Cancel stops it. The CSV is never sent to a server.
Example
An order export with spaces and parentheses in the headers, an ampersand, angle brackets and an empty date, converted with the default settings. Three headers are renamed; the empty Ship date becomes <Ship_date/>.
Order ID,Customer,Total (EUR),Ship date 10071,"Smith & Sons",249.00,2025-02-03 10072,"Café <Lumière>",18.50,
<?xml version="1.0" encoding="UTF-8"?>
<rows>
<row>
<Order_ID>10071</Order_ID>
<Customer>Smith & Sons</Customer>
<Total__EUR_>249.00</Total__EUR_>
<Ship_date>2025-02-03</Ship_date>
</row>
<row>
<Order_ID>10072</Order_ID>
<Customer>Café <Lumière></Customer>
<Total__EUR_>18.50</Total__EUR_>
<Ship_date/>
</row>
</rows>Questions and answers
Why was my column name changed?
XML element names cannot contain spaces or most punctuation, cannot start with a digit and cannot start with xml. The converter makes the smallest change that gives a legal, unique name and lists each one.
Should I use elements or attributes?
Use child elements unless the receiving system asks for attributes. Elements keep line breaks as written; attribute values are whitespace-normalized by XML parsers, which is why the converter encodes tabs and line breaks as character references.
Are numbers or dates given types?
No. XML has no built-in value types, so every value is written as the text in the CSV. Types come from the schema or the program that reads the file.