Data Conversion Tools Runs in your browser Free · no account

CSV to XML Converter

The CSV to XML converter writes one XML element per CSV row, using the header names as child element names. Element names are sanitised so the output is always well-formed, and values are escaped correctly.

Options
CSV data 0 characters
XML to CSV
XML

Your result will appear here.

Not sure where to start? Use Load example.

Results update automatically and are calculated on your device. Nothing you type is sent to a server.

Runs in your browser. Processing happens entirely in your browser. Nothing you enter is sent to Delimiter.live.

How to use the CSV to XML Converter

  1. Paste your CSV or load a file.
  2. Name the root and record elements to match the schema you are targeting.
  3. Copy the XML or download it as an .xml file.

Example

Input
name,age
Ada,36
Output
<records>
  <record>
    <name>Ada</name>
    <age>36</age>
  </record>
</records>

Common use cases

  • Producing an import file for a system that only accepts XML.
  • Building a small product feed from a spreadsheet.
  • Creating XML fixtures for testing a parser.

Limitations and things to watch for

  • XML element names cannot start with a digit or contain spaces, so header names are sanitised: spaces become underscores, invalid characters are removed and a leading digit is prefixed with an underscore. The original header is preserved as a name attribute when sanitising changes it.
  • Values are escaped for XML, and control characters that XML 1.0 forbids are stripped rather than producing an invalid document.
  • The output has no schema or namespace declaration; add those in your target system if it requires them.

Frequently asked questions

What happens to column names with spaces?
Spaces become underscores and any other character that XML does not allow in a name is removed. When a name has to be changed, the original is kept as a name attribute so nothing is lost.
Are special characters escaped?
Yes. Ampersands, angle brackets and quotes are escaped, so values containing markup do not break the document.
Can I choose the element names?
Yes. Set both the root element and the per-row record element to whatever your target schema expects.

Share this tool