CSV ↔ XML

Convert table data to XML attributes or elements, or back to CSV.

FreeNo pass requiredNo ads

Your text and files stay in your browser.

Drop a file here, or use Open file. Ctrl+Enter / Command+Enter runs the tool.

Ready for your input
Processed on your device

Paste text or try an example to begin.

No uploads. No ads. No Data Pass required. Buy me a coffee

Convert tables between CSV and XML

Turn a spreadsheet export into XML with one repeated element per record, or bring simple XML records back into a CSV table. Choose whether each field becomes an attribute or a child element, and name the root and record elements. The converter keeps cell values as text, including leading zeros and deliberate whitespace. It supports table-shaped XML rather than guessing how an arbitrary document should be flattened.

CSV and XML examples

Create XML attributes from a CSV row

Input

name,zip
Avery,00123

Result

<?xml version="1.0" encoding="UTF-8"?>
<records>
  <record name="Avery" zip="00123" />
</records>

Choose CSV to XML and Attributes. The column headers become attribute names. The ZIP identifier keeps its leading zeros because the converter does not infer number types from CSV text.

Bring XML fields into a CSV table

Input

<records><record><name>Avery</name><zip>00123</zip></record></records>

Result

name,zip
Avery,00123

Choose XML to CSV. Each repeated record becomes a row, and its text fields become columns. Attribute-based records work too, but all records must use a consistent field style.

How to convert CSV and XML

  1. Paste a CSV table with a header row, or open a UTF-8 CSV or XML file. Choose the direction that matches the input.
  2. For CSV input, use separator detection or select comma, semicolon, tab, or pipe. Every data row needs the same number of fields as the header.
  3. For XML output, select child elements or attributes and choose the root and record names. CSV headers must also be valid names in the supported XML subset.
  4. Review the result before copying or downloading. Send XML output back to XML to CSV for another conversion, or send CSV output to the existing CSV to JSON tool.

CSV and XML conversion questions

Does XML conversion require an upload?

No. Both directions run in a worker in your browser. The converter does not fetch schemas, load external entities, or contact addresses found inside the input. Files are opened locally and results can be passed between tools in memory.

When should I choose attributes or elements?

Use the structure required by the receiving application. Attributes keep simple records compact, while child elements put each field on its own line. Both styles preserve values as text here. Special characters and line endings are escaped when necessary so the generated XML remains valid.

Which XML structures can become CSV?

Use one root containing repeated record elements with simple names. Each record may have attributes or one level of text-only child fields. Missing fields become empty cells and comments are omitted. Repeated field names, nested fields, namespaces, root attributes, DTDs, and mixed content are rejected rather than silently discarded.

Why was my CSV header rejected?

This converter supports names beginning with an ASCII letter or underscore, followed by letters, digits, underscores, dots, or hyphens. Names cannot start with xml. Rename headers containing spaces, namespace prefixes, or unsupported characters before conversion; the tool does not silently rename your fields.

Use a mapping for complex XML

This is a table converter, not a general XML-to-JSON mapping engine or schema validator. Input is limited to 10 MiB with 250,000 table cells or XML nodes and attributes, plus bounded output and processing time. CSV output cannot retain XML document formatting or comments. Import CSV values as text in a spreadsheet when identifiers or formula-like strings must stay literal.