CSV to XML

Paste CSV and get XML at once, with errors pointed by line and column, then copy or download the result.

loading CSV to XML
About this tool

What are CSV and XML?

CSV is a table in plain text: the first line names the columns and each following line is a row, with cells separated by commas (or semicolons, tabs or pipes). XML marks data with opening and closing tags and attributes; it is older than JSON and still the format of SOAP services, RSS, Office files and many government and banking integrations.

Typical for feeding a spreadsheet into a system that only imports XML, such as product feeds and older ERP integrations.

This page opens the data converter already set to CSV → XML. Paste the text, read the result as you type, then copy it or download it as a file. Errors show the line and the column. Nothing is sent anywhere: the conversion runs in your browser.

CSV vs XML

CSVXML
Extension.csv.xml
Media typetext/csvapplication/xml
Commentsnoyes (<!-- -->)
Data typestext only (numbers are a reading convention)everything is text (types come from a schema)
Nestingnone: one flat tableany depth, plus attributes
Typical usespreadsheets, exports, bulk importsSOAP, RSS, invoices, Office files
SpecificationRFC 4180W3C XML 1.0

When to convert CSV to XML

  • Convert to XML when a SOAP service, a feed or a legacy system expects XML.
  • Keep CSV when the data goes to a spreadsheet, a database import or a report.

What changes in the conversion

  • The first line is the header. Numbers and true/false become real numbers and booleans (you can turn this off); values with leading zeros, like ZIP codes 01310-100 or 007, stay text.
  • The separator is detected: comma, semicolon (common in Excel in Portuguese and Spanish), tab or pipe.
  • Keys starting with @ become attributes and #text becomes the element text. XML needs one root element, so a list or several top-level keys are wrapped in <root> (list items in <item>), and null is written as xsi:nil="true".

How to convert CSV to XML

  1. Paste your CSV in the input box (the page opens with an example you can replace).
  2. Read the XML on the right; it updates as you type. If something is wrong, the message says the line and column.
  3. Adjust the options if you need: indentation, sorted keys or type detection.
  4. Copy the result or download it as a .xml file.

Example

This CSV input:

id,name,city,zip,active
1,Ana Souza,Recife,01310-100,true
2,Bruno Lima,Porto Alegre,90010-000,false
3,"Silva, Carla",Curitiba,80010-000,true

becomes this XML, exactly as the converter writes it:

<?xml version="1.0" encoding="UTF-8"?>
<root>
  <item>
    <id>1</id>
    <name>Ana Souza</name>
    <city>Recife</city>
    <zip>01310-100</zip>
    <active>true</active>
  </item>
  <item>
    <id>2</id>
    <name>Bruno Lima</name>
    <city>Porto Alegre</city>
    <zip>90010-000</zip>
    <active>false</active>
  </item>
  <item>
    <id>3</id>
    <name>Silva, Carla</name>
    <city>Curitiba</city>
    <zip>80010-000</zip>
    <active>true</active>
  </item>
</root>

Frequently asked questions

Is my CSV sent to a server?

No. Conversion happens in your browser, so secrets in a config never leave your computer.

Does CSV to XML keep comments?

CSV has no comments, so there is nothing to lose. XML comments: yes (<!-- -->).

What happens to nested data?

CSV nesting: none: one flat table. XML nesting: any depth, plus attributes. The structure is kept as it is.

Report a problem