Skip to main content

CSV to XML Converter

Paste CSV or drop a file — get clean, well-formed XML instantly. True RFC 4180 parsing, delimiter auto-detect, custom root and row elements, per-column attribute mapping, namespaces, pretty or minified output. Free, no signup.

100% client-side — your CSV never leaves your browser One direction: CSV → XML

1. Your CSV

0 bytes

2. CSV parse options

3. Parsed preview & column mapping

The first 25 rows of your parsed CSV. Use the mapping table to decide, per column, whether it becomes an XML element, an XML attribute on the row, or is skipped.

Nothing to preview yet — paste CSV above.

Column mapping

Column mapping appears after parsing.

4. XML output options

5. XML output

0 rows0 columnsdelimiter: —output: 0 byteswarnings: 0
<!-- Your XML will appear here -->
One direction only: CSV → XML. Need the reverse? XML to CSV converter

How the conversion works

  1. RFC 4180 CSV parsing. Fields wrapped in double quotes may contain the delimiter, line breaks, and doubled quotes ("a""b" → a"b). Most online converters split naively on commas and corrupt quoted fields; this one does not.
  2. Delimiter auto-detect. The tool scores comma, semicolon, tab and pipe across the first lines of your file and picks the delimiter with a consistent, non-zero count — so semicolon CSVs from European Excel and TSV pastes just work.
  3. Valid XML names, enforced. Headers like First Name, 2nd or xmlTag are not legal XML element names. They are sanitized automatically (spaces become underscores, leading digits and reserved xml prefixes are escaped) and every change is reported in the warnings box. Duplicates get _2, _3 suffixes.
  4. Escaping done right. Text content escapes &, <, >; attribute values additionally escape quotes. The optional CDATA mode wraps values instead, splitting any embedded ]]> safely.
  5. Excel to XML workflow. In Excel choose Save As → CSV (Comma delimited); in Google Sheets choose File → Download → Comma Separated Values. Paste the result here with first-row headers on, and each spreadsheet row becomes one XML record.
  6. Private by construction. Parsing and XML generation run entirely in your browser with JavaScript — no upload, no server, no tracking. Disconnect from the internet after the page loads and it keeps working.

CSV to XML — frequently asked questions

How do I convert CSV to XML online with this tool?

Paste your CSV into the input box or drop a .csv file onto it — the XML rebuilds live as you type. Leave the delimiter on Auto-detect, confirm whether the first row holds your headers, then set the root and row element names and copy or download the .xml file. Everything runs in your browser; nothing is uploaded.

Does the converter handle commas inside quoted CSV fields?

Yes. The parser follows RFC 4180: a field wrapped in double quotes may contain commas, line breaks, and doubled quotes, so "a,b",c parses as two fields (a,b and c), and "a""b" becomes a"b. A multiline quoted field keeps its line break inside the XML element text.

How do I turn CSV columns into XML attributes instead of elements?

Open the Column mapping table under the preview: every column has a dropdown where you can switch it between Element, Attribute, and Skip. Attribute columns land on the row element, so a salary column set to Attribute produces <employee salary="95000"><name>Ada</name></employee>. Use the global default selector to flip all columns at once, then fine-tune individual columns.

What are the root and row element names, and which names are allowed?

The root element wraps the whole document (default catalog) and the row element wraps each CSV record (default row). Names must be valid XML names: start with a letter or underscore, followed by letters, digits, dots, hyphens or underscores — no spaces, and they may not start with xml in any casing. If a header or your custom name breaks the rule, the tool sanitizes it automatically and lists exactly what changed in the warnings box.

How do I add an XML declaration or a namespace?

Tick Include XML declaration to prepend <?xml version="1.0" encoding="UTF-8"?> — you can switch the encoding to UTF-16 or ISO-8859-1 and add standalone="yes". For namespaces, enter a prefix and URI and the tool adds xmlns:prefix="..." to the root element. The output stays well-formed either way.

How do I convert a semicolon-separated file, TSV, or an Excel spreadsheet to XML?

Leave the delimiter on Auto-detect — the tool scores comma, semicolon, tab and pipe across the first lines and picks the consistent one, showing its choice above the preview. For Excel, use Save As and choose CSV (Comma delimited); in Google Sheets use File, Download, Comma Separated Values, then paste the result here. TSV pastes work the same way.

What happens to empty cells?

You choose: Omit drops the element entirely, Self-closing emits <tag/>, and Empty element emits <tag></tag>. Attribute columns always render as tag="" when empty. Pick the mode your consuming system or schema expects.

Is my CSV data uploaded to any server?

No. Conversion runs entirely in your browser with JavaScript: your CSV is parsed locally, never sent over the network, and there is no account or signup. You can even disconnect from the internet after the page loads and keep converting.

How do I convert XML back to CSV?

This tool converts one direction only, CSV to XML, which keeps the mapping rules predictable. To go the other way, use our XML to CSV converter, which flattens tagged markup back into tabular rows.

Free tool by NRTechStudio