CSV to XML
Paste CSV with a header row and instantly get well-formed XML, one element per row.
Example
Input CSV:
name,age,city
Ada,36,London
Grace,85,New York
Output XML:
<?xml version="1.0" encoding="UTF-8"?>
<records>
<record>
<name>Ada</name>
<age>36</age>
<city>London</city>
</record>
<record>
<name>Grace</name>
<age>85</age>
<city>New York</city>
</record>
</records>
How it works
It parses the CSV (handling quoted fields, commas, and embedded newlines), uses the first row as element names, and emits an XML document with one record element per data row. Header names are sanitized into valid XML tag names.
Good to know
CSV to XML turns a comma-separated table into a well-formed XML document right in your browser. The first row of your CSV is read as column headers, each remaining row becomes a <record> element, and every cell becomes a child tag named after its column. It is built for developers, data engineers, and analysts who need to feed flat spreadsheet exports into systems that only accept XML, such as legacy APIs, SOAP services, RSS-style feeds, or import routines that expect a fixed element structure.
Reach for it when you have a CSV export from a database, spreadsheet, or reporting tool and the destination requires XML rather than JSON. Because everything runs locally, it is also a safe choice for converting customer lists, financial extracts, or other sensitive records that you would rather not paste into a server-side converter. Paste your data on the left, click Convert, and copy the result; the status line tells you how many rows were converted so you can sanity-check the count against your source.
To read the output, remember that the structure is always two levels deep: a root <records> wrapper, then one <record> per data row, then one tag per column. Tag names come straight from your headers after sanitizing, so spaces and symbols become underscores, names that start with a digit or with "xml" get a leading underscore, and blank headers fall back to column_1, column_2, and so on. Values are XML-escaped, meaning characters like &, <, and > are written as entities and will render correctly when a parser reads them back.
A practical tip: clean up your header row before converting if you want readable tag names, since "First Name" becomes First_Name rather than something like firstName. Also note the tool produces no data types or attributes, every value is emitted as plain text, and fully empty rows are skipped, so the converted row count may be lower than the number of lines in your file.
Frequently asked questions
How are column headers turned into XML tag names?
Each header is trimmed and characters that are invalid in XML names (spaces, symbols, etc.) are replaced with underscores. Names that don't start with a letter/underscore, or that start with 'xml', get a leading underscore so the output is always well-formed. Empty headers become column_1, column_2, and so on.
Does it handle commas, quotes, and newlines inside CSV fields?
Yes. The parser follows standard CSV quoting rules: fields wrapped in double quotes can contain commas and line breaks, and a doubled quote ("") inside a quoted field is treated as a literal quote character. Special XML characters in values are escaped automatically.
Is my data uploaded anywhere?
No — this tool runs entirely in your browser. Your input never leaves your device and it works offline once loaded.
Is it free?
Yes, completely free with no sign-up and no limits.
People also ask
What is the difference between CSV to XML and CSV to JSON?
Both convert a flat table into a structured, nested format, but XML uses opening and closing tags around each value and is common in legacy enterprise systems, SOAP APIs, and feed formats. JSON uses key-value pairs with braces and is more compact and widely used in modern web APIs. Choose the format your destination system requires.
How do I convert a CSV file to XML for free?
Open or paste your CSV (with a header row) into a client-side converter like this one, then click Convert and copy the generated XML. No installation, sign-up, or upload is required because the conversion happens in your browser.
Can XML tag names contain spaces or start with a number?
No. The XML specification does not allow spaces in element names, and a name must begin with a letter or underscore, not a digit. Converters handle this by replacing invalid characters with underscores and adding a leading underscore where needed.
Why does my XML output have fewer records than rows in my CSV?
The first row is consumed as the header, so it does not produce a record. Completely empty rows are also skipped, which can further reduce the count compared to the raw line total in your file.
Does CSV to XML preserve data types like numbers and dates?
No. CSV and XML both store values as text, so numbers, dates, and booleans are written exactly as they appear in the input. Any type interpretation has to be done by the system that reads the XML.
How are special characters like ampersands handled in the XML output?
Characters that have special meaning in XML are escaped into entities, so an ampersand becomes &amp;, a less-than sign becomes &lt;, and a greater-than sign becomes &gt;. This keeps the document well-formed and ensures values reconstruct correctly when parsed.
Can I change the root element or record element names?
This tool uses fixed names: a <records> root with one <record> per row. To rename them you would edit the output text after converting or use a tool or script that lets you configure the wrapper and item element names.
Is it safe to convert sensitive CSV data to XML online?
With a client-side converter the data stays on your device and is never sent to a server, which reduces exposure. Always confirm a tool runs locally, and for highly regulated data follow your organization's own handling policies.
Related tools