CSV to XML

Convert CSV data to an XML formatted file.

About CSV to XML

Some integrations, SOAP services, sitemap generators and older ERPs only accept XML. This tool wraps each CSV row in a record element and each column in a child element named after the header, producing a well-formed XML document with an XML declaration and UTF-8 encoding.

Paste the CSV, set the root and record tag names, click Convert and copy or download the XML. The document is built in your browser with no upload, so the data stays with you.

How to use CSV to XML step by step

  1. Paste the comma-separated CSV into the left box. The first line provides the element names.
  2. Set the root tag (data by default) and the record tag (record by default) to match what the receiving system expects.
  3. Click "Convert to XML". The result appears on the right, indented with two spaces.
  4. Use "Copy" to grab the XML or "Download" to save it as data.xml.

Input and output example

Input

id,name,price
1,Keyboard,29.90
2,Mouse,15.50

Output

<?xml version="1.0" encoding="UTF-8"?>
<data>
  <record>
    <id>1</id>
    <name>Keyboard</name>
    <price>29.90</price>
  </record>
  <record>
    <id>2</id>
    <name>Mouse</name>
    <price>15.50</price>
  </record>
</data>

Why use our CSV to XML?

Common use cases

Limits and tips

Frequently asked questions

Can I change the element names?

Yes for the root and the record elements, through the two inputs above the converter. The field elements always take their names from the CSV header, cleaned of characters that are not allowed in XML names.

What is the difference between CSV and XML?

CSV is a minimal, flat text format: rows of values separated by commas, no metadata, no nesting. XML is a markup language where every value is wrapped in named tags, supports hierarchy, attributes and schema validation, and is verbose but self-describing. Systems that need structure and validation ask for XML.

Why is my XML rejected by the receiving system?

Usually because the element names do not match the expected schema (for example <item> instead of <record>, or a required namespace), or because a header contained characters that were stripped. Adjust the root and record tags here and rename the CSV headers to the exact element names required.

Does the tool add a namespace or a schema reference?

No. The output is plain XML with an XML declaration only. If the destination requires an xmlns attribute or an xsi:schemaLocation, add it to the root element after downloading.

Is the CSV uploaded?

No. The XML string is assembled by JavaScript in your browser and offered as a local download. No data is sent to any server.

Related tools

Other free utilities you may find useful

Available languages