On-device AI — professional-grade, fully private.

Convert CSV to XML

CSV to XML with valid element names and a preview you can trust

  • Nothing uploaded
  • Valid names in any language
  • Elements or attributes
  • Optional XSD schema

Drop a CSV here

CSV, TSV, TXT or PSV · up to 25.0 MB · one file at a time

Settings
Root element

The single element that wraps the whole document.

Row element

Wraps each data row inside the root.

Write columns as
Write columns as

The default for every column. Override any single one in the column table below.

Empty cells
Empty cells

Only xsi:nil can be told apart from a field that was never exported.

Indentation
Indentation

Minified puts the whole document on one line.

Document

What goes into the file besides the rows themselves.

Delimiter
Delimiter

Detected by parsing a sample with each candidate, not by counting separators.

Quote character
Quote character

Files that quote with apostrophes exist; reading one wrongly merges rows.

Encoding

A byte-order mark in the file always wins over this choice.

Skip leading rows
0

For exports with a title above the real header row.

Comment prefix

Rows starting with this are ignored. Leave empty to keep every row.

Group rows by
Pro

Nest rows under a shared value, recovering a hierarchy the CSV flattened.

Namespace URI
Pro

Binds the document to a namespace. Leave the prefix empty for a default namespace.

Pro

Built from the same plan as the document, so the two cannot disagree.

Download as

Applies when a single file is loaded. A batch keeps its source filenames.

Free: one file up to 25.0 MB. Every setting that affects the XML itself is included.

How to convert CSV to XML

  1. 1

    Add your CSV

    Drop a .csv, .tsv, .txt or .psv file onto the page, or browse for it. The delimiter, quote character and encoding are detected from the file itself.

  2. 2

    Name the root and row elements

    Set the top-level container and the element that wraps each row. Anything that is not a legal XML name is repaired and the tool tells you it did.

  3. 3

    Choose how columns are written

    Pick elements or attributes for the whole file, then override any single column to CDATA or skip it entirely in the column table.

  4. 4

    Check the preview

    The first twenty rows are built by the same code as the export and re-read by the browser's own XML parser, so you can see the real document before you commit.

  5. 5

    Download

    Save the XML, and the generated XSD schema alongside it if you asked for one. Several files come back as a single ZIP.

What this CSV to XML tool offers

A CSV is a grid of text. XML is a tree with names, types and rules about what those names may contain. Most of the work of converting between them is in the gap: deciding what each column becomes, and making sure the result is something a parser will actually accept.

  • Names that are legal XML — Element names are built to the XML NCName grammar, so a header of -id, 2024, xml or Total (£) produces a document that parses instead of one that does not.
  • Names in your own language — Führung and 名前 are perfectly legal XML element names and they survive unchanged. A converter that reduces them to F_hrung and __ has lost your column headings.
  • Elements or attributes, per column — Set the default for the file, then override any single column — including CDATA for values that contain markup, and skip for columns you do not want in the output.
  • Three honest answers for an empty cell — An empty element, no element at all, or xsi:nil — which is the only one a consumer can tell apart from a field the exporter forgot.
  • A preview that is the real document — The first twenty rows are built by the same code as the export and re-read by your browser's XML parser, so what you see is what you will get.
  • Runs on your device, not our servers — Reading, parsing and writing all happen locally, in a background thread, so a confidential export stays confidential.

Elements or attributes — and when to use each

This is the first real decision in any CSV-to-XML conversion, and the two shapes are genuinely different documents rather than a style preference.

  • Elements — Each value becomes a child element: <row><city>Paris</city></row>. This is the default and the safe choice — an element can be empty, can be typed, can be declared nillable, and can hold text of any length including newlines.
  • Attributes — Each value becomes an attribute on the row: <row city="Paris"/>. The document is considerably smaller and reads naturally for short identifiers. An attribute cannot be repeated and cannot be nil.
  • CDATA — The value is wrapped in a CDATA section and passes through verbatim. This is what you want for a column holding HTML or another markup fragment. The terminator ]]> is handled by splitting the section, so a value containing it is still correct.
  • Skip — The column is left out of the output entirely — useful for internal keys and audit columns that should not travel to the consuming system.
  • The attribute trap this tool avoids — XML parsers normalize attribute values before an application sees them: a literal tab, newline or carriage return inside an attribute is replaced by a space. A converter that writes a multi-line address straight into an attribute produces a well-formed document that has quietly lost its line breaks. This tool writes those characters as references, so the value survives the round trip intact.

How CSV headers become XML element names

XML is far stricter about names than a spreadsheet is. A header is any text at all; an element name has to start with a letter or underscore and may not contain spaces, most punctuation, or a colon. Rather than emitting whatever the header said and hoping, every name is repaired to the published grammar and the repair is shown to you.

  • Spaces and punctuation — A run of illegal characters becomes a single underscore, so First Name is First_Name rather than First__Name, and Total (£) is Total rather than Total____.
  • A name that cannot start where it starts — A leading digit, hyphen or full stop is prefixed with an underscore rather than deleted — 2024 becomes _2024, which is reversible, where deleting the digit would make 2024 and 024 the same column.
  • The reserved xml prefix — The specification reserves every name beginning with xml in any case. A header called xml or XmlData is prefixed, which is the only legal thing to do with it.
  • Duplicate headers — Two columns called Name become Name and Name_2. The repair itself can create collisions — Total (£) and Total (€) both start out as Total — so this is not optional.
  • Letters from every script are kept — The grammar permits the full Unicode letter range and so does this tool. The one deliberate exception is emoji and other characters above the basic plane: the specification allows them in a name, but real parsers do not. Measured on two independent implementations, one refuses the document outright and the other silently returns the element as plain text with its content gone. An emoji in a header therefore becomes an underscore, so that every parser reads the result the same way.
  • You always see what changed — The column table lists the name that was used and, where they differ, the header it came from. A tool that renames your columns without telling you has the same problem as one that renames them wrongly.

Empty cells, data types and schemas

Two settings decide what a consumer of your XML can conclude from it, and both of them are free.

  • Empty element — <city></city> — the field exists and its value is the empty string. This is the default and it matches what the previous version of this tool produced.
  • Omit — The element is not written at all. Smaller output, and the right answer when the consuming system treats an absent field as unknown.
  • xsi:nil — <city xsi:nil="true"/> — the schema-correct way to say the value is known to be absent, and the only one of the three a consumer can distinguish from the exporter having forgotten the field. The xsi namespace binding is added to the root automatically, because a namespace declared halfway down a document is legal and useless.
  • Type annotation — Turn on xsi:type and each element declares what it holds — xs:integer, xs:decimal, xs:boolean, xs:date, xs:time, xs:dateTime, or xs:string. A column is only given a narrow type when every non-empty value in it matches that lexical form.
  • Why 01234 stays a string — A leading zero means an identifier — a postal code, a part number, a phone number — and the moment it is typed as a number the zero is gone. There is no locale guessing either: the XSD lexical space is fixed, so a German export writing 1.234,56 is correctly a string rather than being silently reinterpreted.

CSV import options

The delimiter, quote character and encoding are detected from the file, and every one of them can be overridden when the detection is not what you wanted.

  • Delimiter — Comma, semicolon, tab or pipe. Detection parses a sample with each candidate and scores how consistent the row widths are, so a comma inside a quoted address does not make a semicolon-separated file look like a comma-separated one.
  • Quote character — Double quote, apostrophe, or none. Files that quote with apostrophes exist, and reading one with the wrong quote character merges rows together rather than failing.
  • Skip leading rows — For exports that carry a title and a blank line above the real header. The count is applied before the delimiter is detected, because a title row is not delimited at all and detecting on it finds one column.
  • Skip blank lines — A row whose every cell is empty is dropped. Testing only for a literally empty line misses what a spreadsheet actually writes for a blank row in the middle of a range.
  • Comment lines — Set a prefix — # is the usual one — and any row starting with it is ignored.
  • Extra columns are kept, not dropped — When a body row is wider than the header, the surplus columns are given generated names and the count is reported. Squaring the file off to the header silently discards data, and the resulting document looks perfectly fine.

Which encoding should I choose?

Auto is right almost always. The reason the list is worth reading is that two of the entries the previous version of this tool offered were the same decoder wearing different names.

  • Auto — A byte-order mark if the file has one, otherwise UTF-8 if the bytes are valid UTF-8, otherwise Windows-1252 — which is what a Western-locale spreadsheet writes when it is not asked for anything in particular.
  • The mark always wins — A byte-order mark is the file stating its own encoding; a dropdown is you guessing. When the two disagree the mark is used and the tool says so, rather than silently doing the right thing while the dropdown shows something else.
  • UTF-16LE and UTF-16BE — What a spreadsheet's Unicode Text export produces. Read as UTF-8 the same bytes become a field of nulls and the whole file parses as one enormous single-column row.
  • Windows-1252 and ISO-8859-1 are genuinely different here — The encoding standard lists iso-8859-1 as a label of windows-1252, so asking a browser for one gives you the other. In real ISO-8859-1 the bytes 0x80 to 0x9F are control characters, not curly quotes and euro signs. This tool implements it properly, which is the only way to read a file that really is Latin-1.

Nesting and namespaces

A CSV is flat and XML is a tree, and the most common reason people want XML in the first place is to recover a hierarchy the spreadsheet flattened. These two features are on the Pro plan because neither is needed to get correct XML out — they are about fitting the document into somebody else's system.

  • Group by a column — Pick a column and rows sharing a value are collected under a group element carrying that value, in the order the file first mentions it. The grouping column is not repeated inside each row, because that would be the flat document again with extra nesting around it.
  • Namespace binding — Give the document a namespace URI, optionally with a prefix. Without a prefix it binds as the default namespace; with one, every element carries it.
  • Generated XSD — A schema built from the same plan and the same type classifier as the document. It is deliberately loose where guessing would hurt: no inferred maximum lengths and no enumerations, because a constraint derived from one export is a constraint the next export violates.
  • Batch into one ZIP — Convert up to 50 files at once and take everything away in a single archive, schemas included. Entry names are made safe and made unique first, so two folders each holding data.csv do not silently collapse into one entry.

The file is decoded, parsed and written in a background thread, a block of rows at a time. A 26.7 MB export converts in about 1.2 seconds and the page stays responsive throughout.

Options at a glance

  • Root/Row tags — Set the top-level and per-row element names. Free — this is what the tool is for.
  • First row as names — Use header fields as child tag names, or generate column_1, column_2 and so on.
  • Output mode — Elements or attributes for the whole file, overridable per column to CDATA or skip.
  • Empty values — Empty element, omitted, or xsi:nil.
  • Type annotation — Add xsi:type to every element, with the type inferred from the whole column.
  • Indentation — Two spaces, four spaces, a tab, or minified to a single line.
  • XML declaration — Include or omit the version and encoding line at the top.
  • Delimiter, quote, encoding — Detected from the file, or set by hand when the detection is not what you wanted.
  • Skip rows, blanks, comments — Leading title rows, empty rows, and lines beginning with a prefix you choose.
  • Download as — Set the output filename. Several files come back as a single ZIP.

Why convert CSV to XML?

CSV says nothing about what its columns mean. XML carries the names, the structure and — with a schema — the types, which is why it is still the format most enterprise and government integrations ask for.

  • System compatibility — Many enterprise, financial and public-sector systems accept XML and nothing else, and will reject a CSV without reading it.
  • Structure the spreadsheet lost — Grouping rows under a key column recovers a hierarchy a flat export had to throw away.
  • A contract, not just data — A generated XSD lets the receiving system validate what you sent instead of being told the shape by email.
  • Unambiguous text — Characters that would break a naive export are escaped, characters XML cannot represent at all are removed and counted, and the result is checked by a parser before you download it.

Frequently asked questions

How does the CSV to XML converter work?

Drop a CSV and the tool reads it on your device: it sniffs any byte-order mark, decodes the text, works out the delimiter and quote character by parsing a sample with each candidate and scoring how rectangular the result is, then turns each row into an element. You name the root and row elements, decide whether each column becomes a child element or an attribute, and download the result. The first twenty rows are shown as real XML before you commit to anything.

Can I customize the XML element and tag names?

Yes, and it is free. Set the root tag (the top-level container) and the row tag (which wraps each data row). Turn on First row as element names to take child element names from your header; turn it off and columns are named column_1, column_2 and so on. Any name that XML would reject is repaired rather than emitted broken — a header of 2024 becomes _2024, one beginning xml is prefixed because that prefix is reserved by the specification, and two columns with the same name are numbered apart. The column table shows the original header next to the name that was used, so nothing is renamed behind your back.

Is my CSV data uploaded to a server?

No. The file is read, parsed and written to XML entirely on your device, in a background thread so the page stays responsive on large files. Nothing is uploaded, stored or transmitted anywhere, so confidential exports stay private from start to finish. The page keeps working with the network disconnected once it has loaded.

Which delimiters and encodings are supported?

Comma, semicolon, tab and pipe, detected automatically or forced by hand, with double-quote, apostrophe or no quoting. Encodings are UTF-8, UTF-16LE, UTF-16BE, Windows-1252 and true ISO-8859-1 — genuinely different decoders, not three labels for the same one. A byte-order mark always wins over the dropdown, because a mark is the file stating its own encoding while a dropdown is a guess, and the tool says when it has overridden your choice.

Should each column be an element or an attribute?

Elements are the safe default: they can be repeated, they can be empty, they can carry a type, and they can hold text of any length. Attributes make the document smaller and read more naturally for short identifiers like an id or a code. You can set the default for the whole file and then override any single column, which is something no other online converter offers. One caution the tool handles for you: XML parsers replace tabs and newlines inside an attribute value with spaces, so a multi-line address written as a raw attribute quietly loses its line breaks. This tool writes them as character references, and the value comes back exactly as it went in.

Can it generate an XSD schema, and does the XML validate against it?

Yes. The schema is built from the same plan and the same type classifier as the document, so the two cannot disagree — a generated schema its own XML fails against is worse than no schema at all. Types are conservative: a column is only declared as an integer, decimal, boolean, date, time or dateTime when every non-empty value in it matches that lexical form, and a value with a leading zero like 01234 stays a string because it is an identifier, not a number. No length limits or enumerations are inferred, because a constraint derived from one export is a constraint the next export breaks.

Is the CSV to XML converter free, and does it work offline?

Everything needed to produce correct, complete, properly escaped XML is free: all delimiters and encodings, root and row naming, elements or attributes, CDATA, the empty-value policy, type annotation, indentation and the whole document up to 25 MB per file. Once the page has loaded it keeps working without an internet connection. A Pro plan adds scale and integration — batch conversion into one ZIP, nesting rows under a key column, namespace binding, and the generated XSD.

What can I use the XML output for, and does it work on mobile?

Data feeds, system imports, API payloads, and the many enterprise and legacy tools that accept XML and nothing else. Because the output is verified against the browser's own XML parser before you download it, you find out about a problem here rather than in the system you are importing into. The tool runs in any modern mobile or desktop browser, so you can convert on a phone too.

4.8out of 5

from 74 ratings

Rate this tool

Tap a star — it takes a second