Skip to main content
PulsarKit

Convert CSV to XML

Wrap a CSV table in valid XML: your own root and row tag names, columns as elements or attributes, headers repaired to legal tag names.

Drop your files here

.csv, .tsv, .txt · up to 300 MB

More settings

How to Convert to XML

  1. 1

    Drop your CSV file

    Drag a .csv, .tsv or .txt file onto the page. The delimiter and the character encoding are worked out from the bytes themselves.

  2. 2

    Name the root and row tags

    Decide what wraps the document and what wraps each line: rows and row by default, or catalog and product if that is what the target system reads.

  3. 3

    Convert and download the XML

    Press the button and save a well-formed document with a declaration and real indentation.

Column headers that cannot be tag names

Real exports have headers like 2024 sales, order id or an empty cell, and none of those is a legal XML name. Dropping such a column would lose data, so instead the name is repaired the way XML 1.0 requires: illegal characters become underscores, a leading digit gets an n in front, and empty headers become column_1. Every rename is listed.

Elements or attributes, and when the choice is overruled

Each column can become a child element of the row or an attribute on it. Attributes make a compact document, but XML parsers normalise a line break inside an attribute value into a space. A column containing multi-line text is therefore written as an element regardless of the setting, and you are told which column it was.

Escaping and encoding you do not have to think about

Ampersands and angle brackets in your data are escaped for you, quotes as well inside attributes, and control characters XML forbids outright are stripped with a count. The result is always UTF-8 without a byte order mark, carrying an XML declaration that says so, whatever encoding the source CSV used.

No upload, no server, no copy

Decoding the CSV, repairing the names, escaping the values and serialising the document all happen in this browser tab, in JavaScript that ships with the page. Your file is never sent anywhere, so a price list or a customer export stays on your machine even while you convert it.

Frequently asked questions

Can I choose the tag names myself?

Yes, both of them. The root element defaults to rows and each record to row, and you can replace either with anything valid, such as catalog and product, or orders and order. A name that XML would reject, such as one starting with a digit, is refused up front with a corrected suggestion rather than producing a broken file.

Should columns be elements or attributes?

Elements are the safer default: they hold any text, including line breaks, and most schemas expect them. Attributes give a much shorter document and suit short identifiers, but the value has to be a single line. Pick whichever shape the system reading the file expects.

What happens to a header like 2024 sales?

By default it is sanitised into a valid tag: the space becomes an underscore and the leading digit gets a prefix, giving n2024_sales. A list of every renamed column is shown so nothing changes behind your back. If you would rather be stopped than corrected, switch invalid names to error instead.

My CSV uses semicolons and Windows-1251. Do I need to convert it first?

No. Semicolon, tab, pipe and colon are all tested alongside the comma, and the encoding is detected from a byte order mark or, failing that, from a strict UTF-8 check with a Windows-1251 or Windows-1252 fallback. Both can be set manually if the detection disagrees with you.

Are empty cells kept in the output?

By default an empty cell becomes an empty self-closing element, which keeps every record the same shape and is easier for a consumer to iterate. Switch empty values to skip and the element is omitted entirely, giving a smaller document with variable-shaped records.

What encoding is the XML written in?

Always UTF-8, without a byte order mark, with a matching declaration at the top. That combination is what XML parsers assume and what avoids the mismatch between a declared encoding and the actual bytes. The declaration can be turned off for fragments meant to be embedded in a larger document.

Two of my columns are called id. What happens?

The second one becomes id_2 and the third id_3, because a consumer walking the children of a record would otherwise have no way to tell them apart. The renames appear in the same list as the sanitised names.

Does the file get uploaded to convert it?

No. Everything runs locally in your browser, with no server involved and no copy of your table kept anywhere once the tab is closed.

Related tools