Quick example: CSV to XML in one paste
Paste your CSV into the tool above, pick XML as the output, and copy or download the result. That's it. The converter handles quoted fields (fields with commas inside them) and auto-detects numbers so they come through as numeric values, not quoted strings.
Input CSV:
name,age,city
Alice,30,London
Bob,25,BerlinOutput XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<row>
<name>Alice</name>
<age>30</age>
<city>London</city>
</row>
<row>
<name>Bob</name>
<age>25</age>
<city>Berlin</city>
</row>
</root>Your data never leaves your browser — the conversion runs entirely on your device, so nothing is uploaded to any server.
Turn spreadsheet data into structured XML instantly
Got a CSV export from Excel, Google Sheets, or a database dump and need it in XML? Paste it above and get clean, well-formed XML in seconds — no signup, no installation, and nothing uploaded anywhere.
XML (Extensible Markup Language) wraps each value in named tags, making data easy to read by machines and humans alike. It's the format many APIs, legacy systems, and config pipelines expect.
How to convert CSV to XML
- Paste or upload your CSV into the input area above.
- Make sure CSV is selected as the source format and XML as the target.
- The converted XML appears instantly in the output panel.
- Click Copy or Download to grab the result.
That's the entire workflow. No button to press, no waiting — the output updates as you type.
Worked example: a product catalogue CSV
Here's a realistic starting point — a short export from an e-commerce system.
Input CSV:
id,product,price,in_stock
101,Wireless Keyboard,49.99,true
102,USB-C Hub,29.95,falseResulting XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<row>
<id>101</id>
<product>Wireless Keyboard</product>
<price>49.99</price>
<in_stock>true</in_stock>
</row>
<row>
<id>102</id>
<product>USB-C Hub</product>
<price>29.95</price>
<in_stock>false</in_stock>
</row>
</root>The column headers become the XML element names. Each CSV row becomes a <row> element nested inside a <root> wrapper. Numbers like 49.99 stay unquoted; text stays as text.
How to do this in Python or JavaScript
For scripts or CI pipelines, you can do the same conversion in code.
Python
import csv, xml.etree.ElementTree as ET
def csv_to_xml(csv_file, xml_file):
root = ET.Element('root')
with open(csv_file, newline='', encoding='utf-8') as f:
reader = csv.DictReader(f)
for row in reader:
row_el = ET.SubElement(root, 'row')
for key, value in row.items():
child = ET.SubElement(row_el, key)
child.text = value
tree = ET.ElementTree(root)
ET.indent(tree, space=' ') # Python 3.9+
tree.write(xml_file, encoding='utf-8', xml_declaration=True)
csv_to_xml('products.csv', 'products.xml')JavaScript (Node.js)
const fs = require('fs');
const { parse } = require('csv-parse/sync'); // npm install csv-parse
const rows = parse(fs.readFileSync('products.csv'), { columns: true });
let xml = '<?xml version="1.0" encoding="UTF-8"?>
<root>
';
for (const row of rows) {
xml += ' <row>
';
for (const [key, val] of Object.entries(row)) {
xml += ` <${key}>${val}</${key}>
`;
}
xml += ' </row>
';
}
xml += '</root>';
fs.writeFileSync('products.xml', xml);The online tool above is ideal when you're doing this once or just want to check the output structure before committing to code.
How it works under the hood
The converter parses your CSV using the first row as the header (column names). Each subsequent row becomes an XML <row> element, and each cell becomes a child element named after its column. The whole thing is wrapped in a <root> element, producing a valid, well-formed XML document (as defined by the W3C XML specification).
Quoted CSV fields — like "Smith, John" — are handled correctly, so commas inside values don't break the output. Special XML characters such as <, >, and & in your data are automatically escaped to keep the XML valid.
Everything runs entirely in your browser. Nothing is sent to a server. Your data is private.
When to use CSV to XML — and when to use something else
| Use XML when… | Choose another format when… |
|---|---|
| The receiving system requires XML (SOAP APIs, many ERP/CRM imports) | You need JSON — lighter and more common in modern REST APIs |
| You need document-style nesting or metadata attributes | You need the data back in a spreadsheet — export as CSV again |
| Configuration files or data interchange with legacy enterprise systems | Your data has deep nesting — a flat CSV can't represent that structure |
If your downstream step also involves JSON, the JSON Beautifier and JSON Validator are handy companions — especially if you're comparing XML and JSON outputs from the same source data. For compressing JSON output, try the JSON Minifier.
Paste your CSV into the tool above and get well-formed XML in seconds — no account needed, completely free.