DevToolPal
EN

CSV to XML Converter

Convert CSV rows into XML elements, using the header row for element names. Detects the delimiter automatically.

Runs locally, never uploaded

Options

Input

0 chars · 0 B

Output

0 chars · 0 B

What it does

This tool converts CSV, the plain-text format that spreadsheets such as Excel and Google Sheets export, into XML. Every data row becomes a <row> element, and each cell becomes a child element named after its column header. The result is well-formed XML that you can feed into systems that only accept XML, such as older APIs, feeds and import tools.

How to use

  1. Paste CSV into the Input box, upload a .csv file, or click Sample.
  2. The XML appears on the right as you type.
  3. Check the options:
    • Delimiter: auto-detected by default.
    • First row is header: use the first row for element names.
    • Root element and Row element: rename <rows> and <row>.
    • Indent and the <?xml ?> declaration.
  4. Copy the XML or download it as an .xml file.

Example

id,name,city
1,Alice Chen,Shanghai
2,"Bob Li","Beijing, China"

becomes

<?xml version="1.0" encoding="UTF-8"?>
<rows>
  <row>
    <id>1</id>
    <name>Alice Chen</name>
    <city>Shanghai</city>
  </row>
  <row>
    <id>2</id>
    <name>Bob Li</name>
    <city>Beijing, China</city>
  </row>
</rows>

Notes

Empty cells become empty elements such as <city/>, and rows with fewer cells than the header are padded. Exported files that start with a byte-order mark (common with Excel) are handled.

FAQ

› How are column names turned into XML elements?

Each header cell becomes the element name for that column. Spaces and symbols become underscores ("signup date" → signup_date), names starting with a digit get a leading underscore, and duplicate names get _2, _3 and so on.

› My CSV uses semicolons or tabs. Does that work?

Yes. The delimiter is detected automatically from the data; you can also pick comma, semicolon, tab or pipe yourself.

› What if the file has no header row?

Turn off "First row is header" and the columns are named column1, column2 and so on.

› How are quotes and commas inside cells handled?

Standard CSV quoting is supported: "Beijing, China" stays one cell and "" inside quotes is a literal quote. Characters like < and & are escaped in the XML.