Home › File & PDF Tools › CSV to XML Converter

CSV to XML Converter

Our free CSV to XML converter turns spreadsheet data into clean, valid XML right in your browser. Paste your CSV or upload a .csv file, pick your delimiter and element names, and copy the XML or download it as a real .xml file — no upload, no sign-up, and no watermark. It handles quoted fields, commas inside values, and line breaks inside cells, so real-world exports convert correctly.

Your data stays on your device. It is converted in your browser and never uploaded anywhere.

Comma is standard; semicolon is common in exports from European spreadsheet settings.

One character, used only when Delimiter is Custom.

The single element that wraps every row.

The element repeated once per data row.

Header names become element names; generic mode ignores the header row.

Saved as .xml — leave blank to use "converted.xml".

The file fills the box above; nothing leaves your device.

How it works

CSV and XML are two ways of writing the same table. A CSV file writes one row per line and separates the columns with a delimiter, usually a comma. An XML file writes the same table as nested elements: one root element wraps everything, one row element wraps each record, and one child element holds each value. This converter reads the CSV the way a spreadsheet does and rebuilds it as that nested structure, keeping every value, every row, and the column order intact.

The parser is a real CSV parser, not a simple split on commas, and that matters for real files. A field wrapped in double quotes may contain a comma, a line break, or even a double quote written as two double quotes, and the parser treats all of that as one value. So an address like "123 Main St, Apt 4" stays in a single element instead of being split in two, and a notes field with a line break inside it does not create a phantom extra row. Unquoted fields are read as they are, and empty fields become empty elements, so a missing value is never silently dropped or shifted into the wrong column.

Delimiters vary by where a file comes from. Comma is the standard, but spreadsheets set to a European locale often export with a semicolon, because the comma is already used as the decimal separator there. Some data exports use a tab or a pipe character instead. Pick the delimiter your file uses from the menu, or choose Custom and type any single character. If the output looks wrong — for example every row becomes one long element — the delimiter is almost always the cause: switch it and convert again.

Element names come from your header row by default. A header of Name, Age, City produces <Name>, <Age>, and <City> elements. Headers are cleaned into valid XML names first: spaces and other disallowed characters become underscores, a name starting with a digit gets a leading underscore, and a blank header becomes col1, col2, and so on. If your file has no header row, use the generic naming mode instead. You can also rename the root and row elements — root could be customers and row could be customer — so the XML matches the names your system expects.

Two formatting choices round it out. Pretty-print indents the nested elements, which makes the file easy to read and to check by eye; turn it off for a compact single-purpose file. The XML declaration, <?xml version="1.0" encoding="UTF-8"?>, is off by default because many tools that consume XML fragments do not want it, but tick the box when your target system asks for a full XML document. Either way, special characters in your data are escaped automatically: a less-than sign becomes &lt;, a greater-than sign becomes &gt;, and an ampersand becomes &amp;, so the output is always valid XML that any XML reader can parse.

CSV row → <row> element · CSV column → child element · header text → element name · "quoted, value" → one element, comma kept

Everything runs in your browser, so your data is never uploaded. Paste the CSV or upload a .csv file, and the tool reports how many rows and columns it found and the size of the XML it produced. Copy the result, or download it as a .xml file with the name you chose.

Worked example

Suppose you have a small customer list in CSV and need it as XML for another system:

Name,Age
Alice,30

Step 1: paste the CSV into the input box, with the delimiter on Comma, the header-row box ticked, and the element names set to "From header row".
Step 2: click Convert to XML. The tool parses the header into the names Name and Age, then reads Alice and 30 as one row.
Step 3: the output is exactly this:

<root>
  <row>
    <Name>Alice</Name>
    <Age>30</Age>
  </row>
</root>

The page reports 1 data row and 2 columns, and the XML is 72 bytes. Turn pretty-print off and the same data becomes the compact form <root><row><Name>Alice</Name><Age>30</Age></row></root>, and ticking the XML declaration adds <?xml version="1.0" encoding="UTF-8"?> as the first line. Now try a quoted value. Change the input to Name,Address and Alice,"123 Main St, Apt 4": the output keeps the whole address in one element, <Address>123 Main St, Apt 4</Address>, because the parser understands the quotes.

If you paste something with no delimiter at all — a single column of values with no commas — the tool still converts it, giving one element per row. If the input box is empty, it shows a friendly message asking for some CSV first instead of producing an empty file.

FAQ

Is my CSV uploaded to a server?

No. Your CSV is parsed and converted entirely in your browser with a real CSV parser. Nothing is uploaded anywhere, so private spreadsheets, customer lists, and order data stay on your own device.

Does the converter handle commas inside quoted fields?

Yes. Fields wrapped in double quotes may contain commas, line breaks, and even double quotes (written as two double quotes). The parser reads them as a single value, so an address like "123 Main St, Apt 4" stays together in one XML element.

What delimiter does my CSV use?

Most CSV files use a comma, but spreadsheets in many regions export with a semicolon, and some data files use a tab or a pipe character. Pick the delimiter your file uses from the menu, or choose Custom and type any single character. If the output looks wrong — for example every row becomes one long element — you have the wrong delimiter.

Can I use my header row as the XML element names?

Yes, that is the default. The first row becomes the element names, so a header of Name, Age produces <Name> and <Age> elements. If your file has no header row, turn the option off and the converter uses generic names such as col1 and col2 instead.

What happens to characters like <, >, and & in my data?

They are escaped automatically, because those characters have special meaning in XML. A less-than sign becomes &lt;, a greater-than sign becomes &gt;, and an ampersand becomes &amp;, so the XML stays valid and any XML reader can turn them back into the original characters.