CSV to XML Converter
Modern APIs prefer JSON, but plenty of enterprise systems still expect XML: SOAP services, product feeds for older marketplaces, SEPA payment files, XBRL filings. This converter takes a CSV, lets you name the root element and the per-row item element, and produces a well-formed XML document where each header becomes a child element inside each row. Special characters are escaped and invalid XML tag names are sanitised so the output parses everywhere.
How the XML is generated
-
1
Paste the CSV
Include a header row so the converter knows what to name each field element.
-
2
Name root and item
Defaults are `<items>` and `<item>`. Override with anything that starts with a letter or underscore.
-
3
Tag names sanitised
Non-word characters become underscores; tags that do not start with a letter fall back to a safe default.
-
4
Values escaped
Ampersands, angle brackets and quotes inside values are replaced with XML entities so the output is always valid.
What the output looks like and where it works
Input CSV
sku,name,price
A-101,Widget,9.99
B-202,Gadget,14.50
Output XML with defaults
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item>
<sku>A-101</sku>
<name>Widget</name>
<price>9.99</price>
</item>
<item>
<sku>B-202</sku>
<name>Gadget</name>
<price>14.50</price>
</item>
</items>
Tag name rules (XML 1.0)
| Allowed | Not allowed |
|---|---|
| Letters, digits, hyphens, underscores, dots | Spaces, &, <, >, quotes, parentheses, slashes |
| Must start with a letter or underscore | Cannot start with a digit or punctuation |
xml prefix is reserved |
Tags starting with xml may be rejected |
The converter silently replaces illegal characters in header names with underscores. If a header starts with a digit, the whole tag falls back to field_N.
Escape table
Values go through htmlspecialchars with ENT_XML1, so these characters are replaced:
&→&<→<>→>"→"'→'
Common downstream uses
- Product feeds for older marketplaces or price comparison sites.
- SOAP request bodies where you need to generate sample payloads from spreadsheet data.
- XBRL or Dublin Core-style simple schemas that map a flat record to named elements.
- Android string resources, though you will need to wrap the whole thing in
<resources>and rename the item elements to<string name="...">.
Frequently Asked Questions
Non-word characters are replaced with underscores, so Product Name becomes Product_Name. If the sanitised name does not start with a letter or underscore, it falls back to field_N to stay XML-valid.
Not directly, every CSV field becomes a child element inside the item. For attribute-based XML you will need to post-process the output or use a schema-specific tool.
Yes. The output starts with <?xml version="1.0" encoding="UTF-8"?>. Remove it by hand if you are embedding the fragment inside a larger document.
Yes. The CSV you paste is sent to our server, because parsing, escaping and XML assembly run there. It is used only to generate the XML result and is not stored.
Related Tools
Word to Markdown Converter
Convert a Word DOCX file to clean Markdown in your browser. Keep headings, lists, links and simple tables, then copy or download the editable .md file.
Subtitle Converter
Convert SRT subtitles to WebVTT or VTT captions to SRT locally. Validate cue timings, preserve multiline text, then copy or download the result.
Excel Sheet Merger
Combine XLSX, XLS, XLSM, XLSB or ODS files locally. Keep source sheets separate or append rows with matching headers, then download an XLSX.
M4A to MP3 Converter
Convert M4A audio to MP3 for wider playback support. Upload an .m4a file and download a compatible .mp3 copy.
CSV to Excel
Convert CSV data to a single-sheet XLSX workbook in your browser. Review delimiters, preserve identifiers, infer safe numbers, and keep file contents local.
Excel Sheet Splitter
Split an XLSX or XLS workbook by worksheet tab, data-row chunks or a column value in your browser. Download one XLSX or a local ZIP, with no file upload.