CSV to XML

Turn CSV rows into XML elements.

Input
CSV input
Output
Result
Options

Detected automatically unless you pick one.

About this tool


Each CSV row becomes one XML element, with a child element per column. Both the wrapper and the per-row element name are configurable, so the output can be shaped to match an existing schema.

This is typically needed for bulk import into systems that accept XML feeds, product catalogues, legacy ERP imports and similar.

How to use it

  1. Paste or upload CSVDrop a .csv file onto the input pane, use the file picker, or paste the text directly.
  2. Adjust the options if neededThe defaults suit most input. Open Options to change how values are interpreted or formatted.
  3. ConvertPress Convert to XML, or use Ctrl+Enter (Cmd+Enter on macOS).
  4. Read any warningsWarnings explain anything that could not be represented exactly in the target format.
  5. Copy or downloadCopy the result, or download it as a .xml file.

Worked examples


Each example below is executed against this tool by the test suite, so what you see is what the tool actually produces.

CSV to XML

Input

id,name
1,Alice
2,Bob

Output

<?xml version="1.0" encoding="UTF-8"?>
<rows>
  <row>
    <id>1</id>
    <name>Alice</name>
  </row>
  <row>
    <id>2</id>
    <name>Bob</name>
  </row>
</rows>

Each row becomes a <row> element with one child per column.

What to watch for


The details that decide whether a conversion is correct, and where information can be lost without any error being raised.

Rows become repeated elements
Every data row produces one <row> element inside a <rows> wrapper, with each column as a child element named after its header. Both names can be changed to match the schema you are targeting.
Column names must be valid XML names
A header like "first name" or "2024" cannot be an element name, so it is rewritten to first_name and _2024 respectively, and the change is reported. Renaming your CSV headers first gives you control over the result.
Special characters are escaped
Ampersands, angle brackets and quotes in cell values are replaced with entity references, so a value containing markup cannot break the document. The output is always well-formed whatever the data contains.
Everything stays text
CSV cells are untyped and XML content is text, so no type conversion happens or is needed. Empty cells become empty elements, which cannot be distinguished from a genuinely empty value.

Limitations


  • Column names that are not valid XML names are rewritten.
  • Empty cells become empty elements, indistinguishable from empty strings.
  • Output is well-formed but not schema-validated.
  • Processing happens in your browser, so very large inputs are bounded by available memory. Files above roughly 10 MB are handled but will feel slower, and multi-hundred-megabyte files are better suited to a command-line tool.

Questions


Can I rename the row and wrapper elements?
Yes, both are configurable in Options so the output can match an existing schema.
Why was a column name changed?
Because it was not a legal XML element name, names cannot start with a digit or contain spaces. Rename the CSV header first if you want a specific result.