100% local — your data never leaves your browser

CSV to XML — A Document That Parses

Convert a CSV table to XML, one element per column. Header names are repaired into legal tag names, so the document opens in any XML tool.

Instant Private Zero cookies
Indentation
Delimiter

CSV input

XML output

What this tool does

Each CSV row becomes a row element inside a rows document, and each column becomes a child element named after its header. Values are escaped as XML requires: an ampersand becomes &, the angle brackets become < and >.

You can choose the indentation, whether types are detected, and whether the XML declaration is written at the top.

Column names are not free

An XML element name has rules, and a spreadsheet header does not. A name cannot contain a space, cannot start with a digit, and cannot contain most punctuation — all of which are ordinary in an exported header row.

So header names are adjusted rather than copied:

  • a forbidden character becomes an underscore: first name gives first_name, a+b gives a_b;
  • a name starting with something XML will not accept is prefixed, not truncated: 2col gives _2col, so you can still tell which column it was;
  • letters XML does allow are left alone, including accented and CJK ones — café and 日本語 pass through unchanged.

The alternative would be to emit the header verbatim and hand you a file that looks converted and fails at the first parse. That failure appears far from its cause, which is what makes it expensive.

Duplicate headers

Two columns with the same name are separated before they reach the XML: the second becomes a_1. No column is silently merged into another. The same applies when two different headers reduce to the same name: user id and user_id both give user_id, so the second becomes user_id_1. Without that, one of the two columns would vanish from the document, value included.

Private by design

Everything runs locally in your browser with JavaScript. Your data is never uploaded, which makes the tool safe for sensitive content, and it keeps working offline.

Frequently asked questions

Why did my "first name" column become first_name?
Because an XML element name cannot contain a space. Leaving it would produce a document no parser accepts, and the error would only surface when someone tried to read the file — not when converting it.
Why is a column named 2col prefixed with an underscore?
Because an XML name cannot start with a digit. Prefixing keeps the whole name readable — you get `_2col`, not a truncated `col` that loses which column it was.
Are accented or CJK column names changed?
No. The XML name rules allow a wide range of Unicode letters, so `café`, `nom-composé` and `日本語` pass through untouched. Only characters XML genuinely forbids are replaced.

Related converters