TXT · Text & Data tools

CSV to XML Converter

Input · CSV
Output · XML
0 Bin0 Bout0lines in0rowsEmptyCSV
Go to the full Data Format Converter

CSV to XML

Convert CSV rows to XML. Paste CSV on the left; the XML output builds on the right as you type.

id,name,role
1,Ada Lovelace,engineer
2,Grace Hopper,engineer

becomes

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <item>
    <id>1</id>
    <name>Ada Lovelace</name>
    <role>engineer</role>
  </item>
  <item>
    <id>2</id>
    <name>Grace Hopper</name>
    <role>engineer</role>
  </item>
</root>

CSV parses into an array of row objects, the same shape CSV to JSON produces, and the XML builder wraps a top-level array in repeated <item> elements since there’s no column to name them after. Each column then becomes a child element inside its row’s <item>.

Naming the outer wrapper

The Root name field controls the outermost element, root by default; set it to something like orders or records to match your schema. The inner <item> tag name is fixed. If you need a specific name per row instead, convert to JSON first, wrap each row object under the key you want, then convert that JSON to XML with JSON to XML.

Everything becomes text

XML text carries no type, so a numeric column like id becomes <id>1</id>, indistinguishable at the XML level from a text column. This matches how JSON to XML already handles numbers: the CSV parsing step’s Coerce types setting affects the JSON produced in between, but every value is written as plain text once it reaches XML.

When CSV to XML isn’t the right pair

If the goal is a specific config format, like an Android layout file or a Maven pom.xml, a flat CSV export usually won’t match the expected shape on its own. Build the target JSON structure by hand first, then use JSON to XML for that final step.

Frequently Asked Questions

A root wrapper element containing one <item> element per row, and inside each <item>, one child element per column, named after the header.

The Root name field on the output side, which defaults to root. The per-row <item> tag name is fixed and isn't configurable from the CSV side.

Not directly from CSV. Convert to JSON first, rename the columns you want as attributes to start with @_, then convert that JSON to XML.

No. XML has no number type, so every cell becomes element text regardless of whether Coerce types is on for the CSV parsing step. The warning strip notes it.

It becomes an empty element, written as a self-closing tag, rather than being dropped from the row.

Jump straight to a conversion

Full Data Format Converter tool

Explore Our Tools

Browse all tools