CSV to XML Converter

Convert CSV into well-formed XML with a root element and one element per row, using your column headings as element names and escaping special characters.

Processed on your device. Files are not uploaded

How to convert CSV to XML

  1. Paste your CSV

    Paste or type it into the box, or press Try an example.

  2. Name the elements

    Choose the root element and the element for each row.

  3. Copy or download

    Save the output as a .xml file.

Worked example

This is what CSV to XML Converter gives for its own sample values. Open the tool above and change anything to try your own.

CSV

id,name,city
1,Ann,Paris
2,Bob,Rome
3,Chloe,Lisbon
4,Deepak,Pune
5,Elena,Oslo
Delimiter
Detect automatically
Root element
data
Element for each row
row
Indentation
2 spaces
Add the XML declaration
Yes

XML

<?xml version="1.0" encoding="UTF-8"?>
<data>
  <row>
    <id>1</id>
    <name>Ann</name>
    <city>Paris</city>
  </row>
  <row>
    <id>2</id>
    <name>Bob</name>
    <city>Rome</city>
  </row>
  <row>
    <id>3</id>
...

About CSV to XML Converter

Turn CSV rows into XML. Each row becomes an element and each column an element inside it, named from the column headings. Special characters are escaped, empty cells become empty elements, and headings with spaces or symbols are made into valid names.

FAQs

What happens to headings with spaces?

Spaces and symbols become underscores, so First name becomes First_name. A heading that starts with a digit gets an underscore in front.

Can I make attributes instead of elements?

Not here. Every column becomes a child element.

Can I convert XML back?

Yes. Use XML to CSV Converter.

Related tools