CSV to XML Converter
Generate XML records from tabular data, choosing the element names and whether columns become elements or attributes.
Your data stays on your device
Input — CSV
- characters
- 0
- lines
- 0
- size
- 0 B
Output — XML
- characters
- 0
- lines
- 0
- size
- 0 B
Options
About this tool
Systems that accept XML imports usually expect a fixed shape: a root element containing one record element per row, with a child element per field. That is exactly what this converter produces, and both element names are yours to set.
CSV headers are rarely valid XML names — they contain spaces, slashes or leading digits. Those are sanitised into legal names automatically, and values are escaped so the result is well-formed no matter what the cells contain.
How to use this tool
- Paste CSV or upload a file, and confirm the delimiter.
- Set the root element name and the per-row element name.
- Choose whether columns become child elements or attributes on the row element.
- Press Convert and download the XML.
Key features
- Configurable root and row element names
- Columns rendered as child elements or as attributes
- Header names sanitised into valid XML names
- Automatic escaping of reserved characters in every value
- Delimiter auto-detection inherited from the CSV parser
- Pretty-printed output with an optional XML declaration
Example
Input — CSV
sku,qty
X1,4
X2,9Output — XML
<?xml version="1.0" encoding="UTF-8"?>
<rows>
<row>
<sku>X1</sku>
<qty>4</qty>
</row>
<row>
<sku>X2</sku>
<qty>9</qty>
</row>
</rows>Good to know
- CSV is flat, so the generated XML is two levels deep. Reconstructing a nested hierarchy requires information CSV does not carry.
- Every value is emitted as text; no type annotations or schema are generated.
- Empty cells become empty elements rather than being omitted, which keeps every record structurally identical.
Frequently asked questions
Elements or attributes for my columns?
Elements are the safer default: they can hold any text, repeat, and be extended later. Attributes suit short identifiers and metadata, and produce a more compact document.
What happens to a header like "Order Date"?
It becomes Order_Date. XML names cannot contain spaces, so invalid characters are replaced with underscores and a leading digit is prefixed.
Is a schema generated?
No. The output is a plain XML document without an XSD or DTD, which is what most import endpoints expect.
Can I nest the output?
Not directly. Convert CSV to JSON first, restructure it, then use the JSON to XML tool for full control over the hierarchy.
Your data stays on your device
Your data is processed locally in your browser and is not uploaded to our server. This page keeps working after you go offline, because there is nothing to send.