Skip to the tool
ViewCSV
Files stay on your device

Convert CSV to XML

orders.csv· SAMPLE DATA15 rows · 8 columns
Values as
<?xml version="1.0" encoding="UTF-8"?>
<rows>
  <row>
    <order_id>001041</order_id>
    <customer>Liam Garcia</customer>
    <city>Austin</city>
    <product>Desk lamp</product>
    <quantity>6</quantity>
    <unit_price>142.72</unit_price>
    <order_date>2026-01-09</order_date>
    <status>paid</status>
  </row>
  <row>
    <order_id>001042</order_id>
    <customer>Mary Clark</customer>
    <city>Seattle</city>
    <product>Monitor 27"</product>
    <quantity>5</quantity>
    <unit_price>210.76</unit_price>
    <order_date>2026-02-03</order_date>
    <status>shipped</status>
  </row>
  <row>
    <order_id>001043</order_id>
    <customer>Henry Taylor</customer>
    <city>Denver</city>
    <product>Notebook A5</product>
    <quantity>1</quantity>
    <unit_price>143.74</unit_price>
    <order_date>2026-03-25</order_date>
    <status>pending</status>
  </row>
  <row>
    <order_id>001044</order_id>
    <customer>Lucas Smith</customer>
    <city>Chicago</city>
    <product>Monitor 27"</product>
    <quantity>5</quantity>
    <unit_price>137.00</unit_price>
    <order_date>2026-04-25</order_date>
    <status>shipped</status>
  </row>
  <row>
    <order_id>001045</order_id>
    <customer>Noah Davis</customer>
    <city>Seattle</city>
    <product>USB-C cable</product>
    <quantity>7</quantity>
    <unit_price/>
    <order_date>2026-05-11</order_date>
    <status>refunded</status>
  </row>
  <row>
    <order_id>001046</order_id>
    <customer>Emma Williams</customer>
    <city>Portland</city>
    <product>Notebook A5</product>
    <quantity>6</quantity>
    <unit_price>166.44</unit_price>
    <order_date>2026-06-10</order_date>
    <status>pending</status>
  </row>
  <row>
    <order_id>001047</order_id>
    <customer> Henry Taylor </customer>
    <city>New York</city>
    <product>Monitor 27"</product>
    <quantity>7</quantity>
    <unit_price>57.53</unit_price>
    <order_date>2026-07-14</order_date>
    <status>pending</status>
  </row>
  <row>
    <order_id>001048</order_id>
    <customer>Lucas Jones</customer>
    <city>Austin</city>
    <product>Desk lamp</product>
    <quantity>7</quantity>
    <unit_price>194.19</unit_price>
    <order_date>2026-08-03</order_date>
    <status>pending</status>
  </row>
  <row>
    <order_id>001049</order_id>
    <customer>Olivia Williams</customer>
    <city>Austin</city>
    <product>USB-C cable</product>
    <quantity>5</quantity>
    <unit_price>190.03</unit_price>
    <order_date>2026-09-07</order_date>
    <status>pending</status>
  </row>
  <row>
    <order_id>001050</order_id>
    <customer>Mary Wilson</customer>
    <city>New York</city>
    <product>Chair, ergonomic</product>
    <quantity>8</quantity>
    <unit_price>61.04</unit_price>
    <order_date>2026-01-15</order_date>
    <status>pending</status>
  </row>
  <row>
    <order_id>001051</order_id>
    <customer>Noah Williams</customer>
    <city>Portland</city>
    <product>Chair, ergonomic</product>
    <quantity>2</quantity>
    <unit_price>61.37</unit_price>
    <order_date>2026-02-25</order_date>
    <status>refunded</status>
  </row>
  <row>
    <order_id>001052</order_id>
    <customer>Mia Smith</customer>
    <city>Boston</city>
    <product>Monitor 27"</product>
    <quantity>5</quantity>
    <unit_price>231.42</unit_price>
    <order_date>2026-03-09</order_date>
    <status>refunded</status>
  </row>
  <row>
    <order_id>001053</order_id>
    <customer>Ava Garcia</customer>
    <city>Boston</city>
    <product>USB-C cable</product>
    <quantity>3</quantity>
    <unit_price>201.24</unit_price>
    <order_date>2026-04-05</order_date>
    <status>pending</status>
  </row>
  <row>
    <order_id>001054</order_id>
    <customer>Mary Clark</customer>
    <city>Boston</city>
    <product>Desk lamp</product>
    <quantity>5</quantity>
    <unit_price>35.49</unit_price>
    <order_date>2026-05-12</order_date>
    <status>pending</status>
  </row>
  <row>
    <order_id>001043</order_id>
    <customer>Henry Taylor</customer>
    <city>Denver</city>
    <product>Notebook A5</product>
    <quantity>1</quantity>
    <unit_price>143.74</unit_price>
    <order_date>2026-03-25</order_date>
    <status>pending</status>
  </row>
</rows>

15 rows · 1 file

Open or paste a CSV file and get well-formed XML: a root element, one row element per record, and each value as a child element or an attribute. Headers that are not legal XML names, such as Order ID or 2024 total, are renamed and every rename is listed. The file is converted in your browser and never uploaded.

How to convert CSV to XML

  1. Select Open file, drop a .csv, .tsv or .txt file on the tool, or choose Paste. Check the delimiter and encoding under Import settings if the columns look wrong.
  2. Name the Root element and Row element (rows and row by default) to match what the receiving system expects.
  3. Choose Values as, empty-value handling, Indentation and the declaration, then select Copy or Download XML.

If the system reading the file expects specific tag names, rename the CSV columns first with Map CSV columns so no automatic renaming is needed.

What each option does

Child elementsThe default: <row><Customer>Smith &amp; Sons</Customer>…</row>. Keeps line breaks in values and suits most import tools.
AttributesOne self-closing element per row: <row Customer="Smith &amp; Sons" …/>. Compact; tabs and line breaks in values are written as &#9;, &#10; and &#13; so a parser keeps them.
Leave out empty valuesOff by default, so an empty cell becomes an empty element such as <Ship_date/>. On, the element or attribute is left out of that row.
Indentation2 spaces (default), 4 spaces, or None (minified), which writes the whole document on one line.
Add the XML declarationOn by default: the first line is <?xml version="1.0" encoding="UTF-8"?>. Turn it off when the XML will be embedded in another document.

The root and row names go through the same name rules as headers; a blank or invalid entry falls back to rows or row, or gets an underscore prefix.

How column names become XML names

  • Spaces become _ and any character other than letters, digits, ., - and _ becomes _: Total (EUR) → Total__EUR_, e-mail:work → e-mail_work. Colons are replaced, so no namespace prefixes are created.
  • A name that starts with a digit, . or - gets a leading underscore (2024 total → _2024_total); so does a name starting with xml in any case, which XML reserves (xml_ref → _xml_ref).
  • If two headers end up with the same name, the second gets _2 (a b and a_b → a_b, a_b_2). XML names are case-sensitive, so Name and name stay distinct.
  • Letters from any script are kept: Größe and 価格 are valid XML names. A blank header first becomes Column 7, then Column_7.
  • Every rename is listed under the options as old → new, and a notice above the preview gives the count.

How values are written

  • &, < and > are escaped in element text; attributes also escape ". Values are otherwise written exactly as in the CSV: 00731 keeps its zeros and no type is guessed.
  • XML 1.0 forbids most control characters (U+0000–U+001F except tab, line feed and carriage return), U+FFFE, U+FFFF and unpaired surrogates even when escaped. They are removed and the number of affected values is shown.
  • Quoted commas, quotes and line breaks are read per RFC 4180; a line break stays a real line break inside a child element.
  • The output is always UTF-8.

Troubleshooting

  • My import tool cannot find a field. It was probably renamed. Check the list under the options and rename the column in the CSV or adjust the mapping in the receiving system.
  • A parser reports an encoding error. Open the source file with its real encoding under Import settings; the XML is UTF-8 only if the CSV was decoded correctly.
  • Everything is in one element. The delimiter was guessed wrong; set Comma, Semicolon, Tab or Pipe under Import settings.
  • I need CDATA, namespaces or a schema. The converter writes plain elements and attributes only; add those in a later step.

Limits and privacy

Files up to 25 MB, 100,000 rows or 2 million cells open with a live preview of the first 200 rows. Larger files are converted in streaming mode: the file is read twice in chunks (once to measure the columns, once to write), a notice says the download covers the whole file, and Copy is not offered. A single output file is capped at 4 GB.

The conversion runs in a background worker in this tab, so the page stays responsive and Cancel stops it. The CSV is never sent to a server.

Example

An order export with spaces and parentheses in the headers, an ampersand, angle brackets and an empty date, converted with the default settings. Three headers are renamed; the empty Ship date becomes <Ship_date/>.

CSV
Order ID,Customer,Total (EUR),Ship date
10071,"Smith & Sons",249.00,2025-02-03
10072,"Café <Lumière>",18.50,
XML
<?xml version="1.0" encoding="UTF-8"?>
<rows>
  <row>
    <Order_ID>10071</Order_ID>
    <Customer>Smith &amp; Sons</Customer>
    <Total__EUR_>249.00</Total__EUR_>
    <Ship_date>2025-02-03</Ship_date>
  </row>
  <row>
    <Order_ID>10072</Order_ID>
    <Customer>Café &lt;Lumière&gt;</Customer>
    <Total__EUR_>18.50</Total__EUR_>
    <Ship_date/>
  </row>
</rows>

Questions and answers

Why was my column name changed?

XML element names cannot contain spaces or most punctuation, cannot start with a digit and cannot start with xml. The converter makes the smallest change that gives a legal, unique name and lists each one.

Should I use elements or attributes?

Use child elements unless the receiving system asks for attributes. Elements keep line breaks as written; attribute values are whitespace-normalized by XML parsers, which is why the converter encodes tabs and line breaks as character references.

Are numbers or dates given types?

No. XML has no built-in value types, so every value is written as the text in the CSV. Types come from the schema or the program that reads the file.

Standards and references