Toolvore

CSV to XML

Convert CSV to XML with original headers, leading zeros and empty strings preserved.

This tool processes its input contents in your browser instead of sending them to a processing service. Page, asset and fixed usage-measurement requests are described on the Privacy page.

Convert CSV records to generic XML fields while retaining original header names, string values, empty cells and row order.

How to use it

  1. 1Paste a header and data rows or open a UTF-8 CSV file.
  2. 2Convert with comma, semicolon or tab and optional root/record names.
  3. 3Review the field mapping, then copy or download the XML.

Example

Input
Product ID,Notes 00123,"Paper & ink"
Output
<field name="Product ID">00123</field> and <field name="Notes">Paper &amp; ink</field>

Generic record mapping; not a vendor-specific import schema.

What happens to your data

CSV and XML stay in tab memory. No remote parsing, URL import or persistent history; fixed usage measurements exclude source data and filenames.

Last updated November 2026

Convert a CSV table into a simple, predictable XML document without uploading it. Each data row becomes a record, and each cell becomes a field whose name attribute holds the original CSV header. This mapping supports headers such as Product ID or Price ($) without silently renaming them into XML element names. Leading zeros, empty strings and quoted multiline cells remain text.

How it works

Paste a header plus data rows, or open a local UTF-8 file, then choose Convert to XML. Comma is the default separator; semicolon and tab can be selected. The parser requires unique, nonblank headers and consistent row widths. Quoted commas, doubled quotes and quoted line breaks follow the supported CSV grammar. An initial UTF-8 BOM is removed and reported. Input is bounded to 2 MiB, 5,000 data rows, 200 columns and 200,000 cells including headers.

The default structure is <records><record><field name="Original header">cell text</field></record></records>. Root and record names can be changed using a deliberately simple ASCII XML-name subset: 1–64 letters, digits, underscores, dots or hyphens, starting with a letter/underscore, without a namespace colon or an xml prefix. Header names are not converted to tags. They are retained as escaped attribute values, so punctuation and potential name collisions do not need guessed substitutions. Source row and column order is retained.

All cell values stay strings. Empty cells produce explicit empty field elements; 00123 remains 00123, and a cell reading null is not turned into a null value. XML markup characters are escaped rather than interpreted. Carriage returns use numeric character references so normal XML parsing can retain them; header tabs and line breaks are also character-referenced to avoid attribute-whitespace normalization. XML 1.0 cannot represent every Unicode/control value, so unsupported characters and unpaired surrogates reject the whole conversion instead of being removed or replaced.

The generated document contains an XML declaration and no DTD, external entities, stylesheet or network reference. It is a generic table mapping, not a particular vendor's import schema, XML Schema validation or a reconstruction of an original XML document. Check the receiving application before using the export. The result reports records, fields, cells, empty strings and the original field mapping. The output contains values, so keep downloads private when the source is sensitive.

Output is limited to 10 MiB; no successful result is silently truncated. Editing source, separator or element names invalidates prior output. Clear and replacement file reads discard stale results. Optional usage measurement records conversion outcomes and result actions only, excluding the CSV, XML, headers, values and filenames. There is no persistent input history or input in a URL.

Worked example: A header with a space needs no renaming

Input
Product ID,Notes 00123,"Paper & ink"
Result
<records><record><field name="Product ID">00123</field><field name="Notes">Paper &amp; ink</field></record></records>

Whitespace indentation is omitted here for readability; the download is formatted XML.

Common use cases

  • Prepare generic XML records from a small spreadsheet CSV export.
  • Keep headers with spaces or punctuation without lossy tag-name sanitization.
  • Retain product codes with leading zeros and intentional empty strings.
  • Review a row/column mapping before adapting XML to a receiving application's schema.

Frequently asked questions

Why are headers stored as name attributes?+

CSV headers can contain spaces or punctuation that cannot directly be XML tag names. A fixed field element with the original header in its name attribute avoids silent renaming and collisions.

Does the converter guess numbers, dates or nulls?+

No. Every CSV cell remains text. Leading zeros remain, an empty cell stays an empty string, and the text null is not interpreted as a special value.

Can any XML importer use this file?+

Not necessarily. This is a generic record/field mapping. Some products require specific tags, attributes or a vendor schema. Check their import requirements and adapt the structure deliberately.

What happens to XML-invalid control characters?+

The entire conversion is rejected with an explanation. Unsupported characters are never quietly deleted or replaced in a successful export.

Does the file leave my browser?+

No. Parsing and generation happen locally. Fixed optional usage measurements exclude input and output contents, headers, values and filenames.