CSV to XML Converter
Paste or drop a CSV and get indented XML, with your own root and row element names.
Paste your CSV or drop a .csv file here. Converted live as you type, and nothing leaves your browser.
Header row
Cell values
How to convert CSV to XML online
Add your CSV
Paste the rows into the input, or drop a .csv file onto it to load the whole export at once.
Name the elements
Set the root element that wraps the document and the row element that wraps each record.
Choose where values go
Put each cell in its own child element, or fold every cell onto the row element as attributes.
Copy or download
The indented XML updates as you type. Copy it to the clipboard or save it as a .xml file.
Why use this tool
Real CSV handling
Quoted fields containing commas, line breaks, and doubled quotes are read correctly instead of being split at every comma.
Your element names
Set the root element and the row element yourself, so the output matches the schema you are feeding rather than a generic wrapper.
Elements or attributes
Each cell can become a child element or an attribute on the row element, which is the difference between a verbose and a compact document.
Column names made legal
A heading like "2024 Sales" cannot be an element name, so spaces become underscores and a leading digit gets one in front. The tool says when it did this.
Correct escaping
Ampersands, angle brackets, and quote characters in your data are escaped, so a value like "Pens & Pencils" cannot break the document.
Nothing is uploaded
The conversion runs in your browser, so a customer or order export never leaves your device.
About this tool
CSV is what a spreadsheet or a database export hands you. XML is what a lot of enterprise imports, feeds, and older integrations still want. This converter sits between the two: paste the rows or drop the file, and the XML appears indented and ready to save. There is no convert button, because the output regenerates every time you edit the input or change an option.
The two element names are the part people usually need to control. The root element wraps the whole document, and the row element wraps each record, so a products feed can produce catalog and product instead of a nameless wrapper. Column headings become element or attribute names, and because XML names cannot contain spaces or start with a digit, a heading like "Unit Price" or "2024 Sales" is adjusted to a legal name and the tool tells you it happened. Turn the header option off when the file has no heading row and the columns are named column1, column2, and so on instead.
Data quality is where naive converters fall over. A field wrapped in quotes can hold commas and line breaks and is still one cell here. Ampersands, angle brackets, and quote characters are escaped, so a value like "R&D (internal)" or a product name full of punctuation stays valid. Empty cells become empty elements rather than disappearing, so every record keeps the same shape. If you need a different target format, CSV to JSON covers APIs and fixtures, XML to JSON goes the other direction, and the XML formatter will re-indent a document you got from somewhere else.
Frequently asked questions
- How do I convert a CSV file to XML?
- Paste the rows into the input or drop the .csv file onto it. Set the root and row element names, pick whether cells become child elements or attributes, then copy the XML or download it as a file.
- What happens to column names that are not valid XML names?
- An XML name cannot contain spaces and cannot start with a digit, so "Unit Price" becomes Unit_Price and "2024 Sales" becomes _2024_Sales. Duplicate headings get a numeric suffix. A note under the output tells you when any name was adjusted.
- Should cell values be elements or attributes?
- Child elements are the safer default: they can hold any text, including line breaks, and they are easier to extend later. Attributes produce a much shorter document and suit simple flat records where every value is a short string.
- Does it handle commas and line breaks inside a field?
- Yes. Standard CSV quoting is supported, so a field wrapped in double quotes can contain commas, line breaks, and doubled quote characters without being split into extra columns.
- What happens to empty cells?
- An empty cell becomes an empty, self-closing element in element mode, or an attribute with an empty value in attribute mode. Rows keep the same shape either way, which matters if the XML is being validated against a schema.
- Is my CSV uploaded anywhere?
- No. The conversion runs entirely in your browser. Your rows are never sent to a server, never logged, and are gone as soon as you close the page.
Related tools
CSV to JSON
Paste CSV and get a clean JSON array of objects, with header detection and automatic number and boolean typing.
XML Formatter & Validator
Pretty-print, minify, and validate XML, with the parse error shown inline.
JSON to XML Converter
Turn a JSON document into pretty-printed, well-formed XML, with control over the root element, array item names, and whether values become elements or attributes.
Acceleration Converter
Convert acceleration between m/s², ft/s², g-force, mph/s, and more.
Angle Converter
Convert an angle between degrees, radians, gradians, turns, arcminutes and arcseconds, with a degrees-minutes-seconds breakdown.
Area Converter
Convert area between metric and imperial units instantly.