What Is This Tool?
Some systems (legacy enterprise software, certain SOAP-based APIs, RSS-adjacent feeds) expect data as XML, while spreadsheets and most data-import tools expect CSV. This tool moves data between the two formats: CSV → XML wraps each row in a <row> element inside a root <rows> element, with each column becoming a child tag named after the header; XML → CSV does the reverse, extracting one column per distinct child tag name it finds.
The CSV side is parsed with a proper quoted-field parser (not a naive split on commas), so values containing commas, line breaks, or embedded quotes are handled correctly. The XML side is parsed using the browser's native DOMParser API — the same interface browsers use internally to parse XML documents — rather than a hand-rolled regex-based reader, so nested tags and standard XML escaping are handled the way a real XML parser handles them.
Column/tag names that aren't valid XML element names (containing spaces, starting with a digit, etc.) are automatically sanitized when generating XML, since XML element names have stricter rules than CSV headers do.
Source: CSV parsing follows RFC 4180; XML structure follows the W3C XML 1.0 specification.
Why Use It?
- Works in both directions — CSV to XML and XML to CSV, in one tool.
- Correct CSV parsing — handles quoted fields with commas, line breaks and escaped quotes, not just a naive comma split.
- Standards-based XML parsing — XML → CSV uses the browser's built-in DOMParser rather than a custom regex parser, so malformed XML is reported as an error instead of silently producing garbage.
- Automatic XML escaping — special characters like & and < in your CSV values are escaped correctly when generating XML.
- 100% client-side — nothing you paste here is uploaded to a server.
How to Use
- Paste CSV data (with a header row) or XML data into the box.
- Click "CSV → XML" to generate XML, or "XML → CSV" to convert XML back to a table.
- Review the output — copy it or download it as a file.
- For CSV → XML, each row becomes a <row> element with one tag per column, wrapped in a <rows> root.
Example
Input
name,age
Alice,30
Bob,25Output
<?xml version="1.0" encoding="UTF-8"?>
<rows>
<row>
<name>Alice</name>
<age>30</age>
</row>
<row>
<name>Bob</name>
<age>25</age>
</row>
</rows>Each CSV row becomes one <row> element, and each column becomes a child tag named after the header — running this XML back through "XML → CSV" reconstructs the original two-column table.
Practical tips
- Feeding data into a legacy system or SOAP API that expects XML: convert your CSV export here first, then paste the XML output directly into the target system.
- Auditing an XML export you received: run XML → CSV to get a quick, readable table view without needing a full XML editor.
- If your XML uses deeply nested elements rather than a flat <row><column> structure, this tool won't flatten arbitrary nesting — it expects one level of row elements, each containing simple column elements.
Why DOMParser instead of a hand-written XML reader
XML has real structural rules — nested elements, attribute quoting, character escaping for &, <, >, and so on — that a quick regex-based parser tends to get subtly wrong on anything but the simplest input. Using the browser's built-in DOMParser API means this tool relies on the same standards-compliant XML engine the browser itself uses to render XML documents, rather than reimplementing XML parsing from scratch. It also means malformed XML — an unclosed tag, a stray angle bracket — surfaces as a clear parse error instead of quietly producing a corrupted or incomplete CSV.
Frequently Asked Questions
Does this handle CSV values with commas or quotes correctly?
Yes. The CSV parser is a proper state-machine parser that tracks whether it's inside a quoted field, so commas and line breaks inside quotes (e.g. "Smith, John") and doubled quotes used to escape a literal quote character are all handled correctly — it doesn't just split on every comma.
How is the XML parsed — is it a custom regex parser?
No. XML → CSV uses the browser's built-in DOMParser API to parse the XML into a real document tree, the same way the browser parses any XML document. This means malformed XML is detected and reported as an error, rather than silently producing incorrect output the way a hand-written regex-based parser might.
What happens to column names that aren't valid XML tags?
Anything that isn't a letter, digit, underscore, hyphen or period is replaced with an underscore, and a leading underscore is added if the name would otherwise start with a digit or punctuation — since XML element names can't start with a number or contain spaces the way a CSV header can.
Is my data uploaded to a server?
No. Both directions of conversion run entirely in JavaScript in your browser, using the browser's own XML parsing engine — nothing is sent anywhere, so it's safe to use with exported business or customer data.
Will converting CSV → XML → CSV give back exactly what I started with?
For well-formed CSV with a consistent set of columns, yes — the round trip preserves the values. If your original CSV had inconsistent columns across rows or unusual characters in the header names, the sanitized tag names mean the exact header spelling may not be perfectly preserved, though the data values will be.