CSV To XML

Login

Email
Password

Don't have an account yet?

Go to Sign up

{{ workbook ? 'Online Table Editor' : 'Input Data' }}
Change File Enter Data
Row Col Row Col
Transpose Clear Delete Empty Deduplicate
ABC abc Abc
Replace
First Row as Header
{{ displayRows.length }} rows x {{ displayHeaders.length }} columns{{ firstRowAsHeader ? ' (1 header)' : '' }} {{ selectedRows.length > 0 ? selectedRows.length + ' selected' : '' }}
Output Data
{{ copied ? 'Copied!' : 'Copy to Clipboard' }} Download File
Properties
Convert CSV to XML online — paste, edit, and download XML.

Escape XML Characters:
Escape XML special characters (<, >, &, ", ')
Minify Output:
Generate compressed XML, removing extra whitespace
XML Declaration:
Add XML declaration header (<?xml version="1.0"?>)
Attribute Mode:
Output data as XML attributes instead of child elements
CDATA Wrapper:
Wrap text content with CDATA to protect special characters
Indent Size:
2 spaces 4 spaces 8 spaces Tabs
Encoding:
Root Element:
Row Element:
Convert Restart
Insert Row Below
Insert Row Above
Insert Column Right
Insert Column Left
Delete Row {{ contextMenu.row + 1 }}
Delete Column {{ contextMenu.col + 1 }}
Clear Cell
Clear Row
Case sensitive Use regex Cancel Replace All

CSV to XML — Free Online Converter with Table Editor

What Is XML?

XML (eXtensible Markup Language) is a markup language defined by the W3C for encoding documents in a human-readable, machine-readable format. It uses tags to define structure and meaning.

<?xml version="1.0" encoding="UTF-8"?>

<catalog>

 <book id="1">

   <title>The Great Gatsby</title>

   <author>F. Scott Fitzgerald</author>

   <price>10.99</price>

 </book>

 <book id="2">

   <title>1984</title>

   <author>George Orwell</author>

   <price>8.99</price>

 </book>

</catalog>

XML Structure

ConceptSyntaxDescription
Declaration<?xml version="1.0"?>Optional header specifying XML version and encoding
Root element<root>...</root>Single top-level container for all data
Child elements<name>Alice</name>Nested elements with text content
Attributes<row id="1">Name-value pairs within opening tags
Self-closing<empty/>Elements with no content
CDATA<![CDATA[...]]>Unparsed character data (preserves special characters)
Comments<!-- comment -->Non-rendered annotations

Why Convert CSV to XML?

Use CaseDescription
Data interchangeExchange data between systems that require XML (SOAP, RSS, Atom)
Configuration filesGenerate XML config files from CSV data
Legacy system importFeed CSV data into systems that only accept XML
RSS feedsConvert product catalogs to RSS/XML feed format
SOAP servicesCreate XML payloads for SOAP web services
Android resourcesGenerate XML string/adapter resources from CSV
SVG dataCreate SVG-compatible data structures
Microsoft OfficeExcel, Word, and PowerPoint use XML-based formats
Sitemap generationConvert URL lists to XML sitemaps
PublishingXML is standard in publishing workflows (DocBook, DITA)

XML Elements vs. Attributes

This tool offers two output modes:

Element Mode (Default)

Data values appear as child elements:

<root>

 <row>

   <name>Alice</name>

   <age>30</age>

   <city>New York</city>

 </row>

</root>

Attribute Mode

Data values appear as attributes on the row element:

<root>

 <row name="Alice" age="30" city="New York"/>

</root>

When to Use Each

ModeBest For
ElementsComplex data, long text values, data that may contain special characters
AttributesSimple key-value pairs, IDs, short metadata, compact output

W3C recommendation: Use elements for data, attributes for metadata.

Core Features

1. Online Table Editor

After loading CSV data, an interactive spreadsheet grid lets you edit before converting:

OperationDescription
TransposeSwap rows and columns
ClearRemove all data
Delete EmptyRemove empty rows/columns
DeduplicateRemove duplicate rows
ReplaceFind and replace (with regex support)
Case transformUPPERCASE, lowercase, Title Case
Insert/deleteRight-click for row/column operations
First Row as HeaderToggle header treatment

2. Escape XML Characters

Converts XML-reserved characters to entities:

CharacterEntity
<&lt;
>&gt;
&&amp;
"&quot;
'&apos;

Without escaping (invalid XML):

<description>Price < 100 & > 50</description>

With escaping (valid XML):

<description>Price &lt; 100 &amp; &gt; 50</description>

Always enable this when data may contain <, >, &, ", or '.

3. Minify Output

Removes whitespace, indentation, and line breaks:

Regular:

<root>

 <row>

   <name>Alice</name>

 </row>

</root>

Minified:

<root><row><name>Alice</name></row></root>

Use minified for production (smaller file size). Use regular for development and debugging.

4. XML Declaration

Adds the XML declaration header:

<?xml version="1.0" encoding="UTF-8"?>

The declaration is recommended for all XML documents. It tells parsers the XML version and character encoding. Disable only when embedding XML fragments into larger documents.

5. CDATA Wrapper

Wraps text content in CDATA sections to preserve special characters without escaping:

With CDATA:

<description><![CDATA[Price < 100 & > 50]]></description>

Without CDATA (with escaping):

<description>Price &lt; 100 &amp; &gt; 50</description>

CDATA preserves the original text exactly. Use when:

  • Data contains HTML or markup

  • Data contains many special characters

  • You want the output to remain human-readable

  • Content includes code snippets or formulas

6. Indent Size

OptionWhen to Use
2 spacesDefault — clean, compact
4 spacesDeeply nested XML
8 spacesVery deep nesting
TabsMatch project conventions

7. Encoding

Sets the character encoding in the XML declaration. Default: UTF-8.

EncodingWhen to Use
UTF-8Default — supports all Unicode characters
ISO-8859-1Legacy Western European systems
Windows-1252Legacy Windows systems
UTF-16Systems requiring wide character encoding

8. Root Element

Sets the name of the top-level XML element:

<catalog>    <!-- Root Element = "catalog" -->

 <row>...</row>

</catalog>

Common choices: data, catalog, records, results, feed.

9. Row Element

Sets the name of each row-level XML element:

<data>

 <book>...</book>    <!-- Row Element = "book" -->

 <book>...</book>

</data>

Common choices: row, record, item, book, product, user, entry.

10. Privacy by Design

All processing runs entirely in your browser. No data is uploaded to any server.

How to Use This CSV to XML Converter?

Step 1: Load CSV Data

Choose one of two input methods:

  • Upload a file: Click "Choose File" and select a .csv file.

  • Paste data: Click "Enter Data" to switch to the code editor. Paste your CSV.

Step 2: Edit in Table Editor (Optional)

The data loads into an interactive grid. Use the toolbar to:

  • Transpose, deduplicate, delete empty rows

  • Find/replace values

  • Transform text case

  • Insert/delete rows and columns

Step 3: Configure XML Output

Use the Properties panel:

  1. Escape XML Characters: Enable for data containing <, >, &

  2. Minify Output: Enable for compact production output

  3. XML Declaration: Enable to add <?xml version="1.0"?>

  4. Attribute Mode: Enable for attributes; disable for child elements

  5. CDATA Wrapper: Enable to preserve special characters as-is

  6. Indent Size: Choose formatting

  7. Encoding: Set character encoding (default: UTF-8)

  8. Root Element: Enter root tag name (e.g., catalog)

  9. Row Element: Enter row tag name (e.g., book)

Step 4: Convert

Click Convert. The XML appears in the "Output Data" panel.

Step 5: Copy or Download

  • Click Copy to Clipboard to paste into your .xml file.

  • Premium users can click Download File to save.

Complete Example

Example — Book Catalog (Element Mode)

Input CSV:

title,author,price,year

The Great Gatsby,F. Scott Fitzgerald,10.99,1925

1984,George Orwell,8.99,1949

To Kill a Mockingbird,Harper Lee,12.99,1960

Configuration:

  • Escape XML: On

  • XML Declaration: On

  • Attribute Mode: Off (elements)

  • CDATA: Off

  • Indent: 2 spaces

  • Root Element: catalog

  • Row Element: book

Output:

<?xml version="1.0" encoding="UTF-8"?>

<catalog>

 <book>

   <title>The Great Gatsby</title>

   <author>F. Scott Fitzgerald</author>

   <price>10.99</price>

   <year>1925</year>

 </book>

 <book>

   <title>1984</title>

   <author>George Orwell</author>

   <price>8.99</price>

   <year>1949</year>

 </book>

 <book>

   <title>To Kill a Mockingbird</title>

   <author>Harper Lee</author>

   <price>12.99</price>

   <year>1960</year>

 </book>

</catalog>

Example — Attribute Mode

Same input CSV.

Configuration: Attribute Mode: On, Root: employees, Row: employee

Output:

<?xml version="1.0" encoding="UTF-8"?>

<employees>

 <employee title="The Great Gatsby" author="F. Scott Fitzgerald" price="10.99" year="1925"/>

 <employee title="1984" author="George Orwell" price="8.99" year="1949"/>

 <employee title="To Kill a Mockingbird" author="Harper Lee" price="12.99" year="1960"/>

</employees>

Example — CDATA for HTML Content

Input CSV:

name,description

Widget A,Contains <b>bold</b> text & special chars

Widget B,Price is < $100 for "premium" items

Configuration: CDATA: On

Output:

<?xml version="1.0" encoding="UTF-8"?>

<data>

 <row>

   <name>Widget A</name>

   <description><![CDATA[Contains <b>bold</b> text & special chars]]></description>

 </row>

 <row>

   <name>Widget B</name>

   <description><![CDATA[Price is < $100 for "premium" items]]></description>

 </row>

</data>

Example — Minified (Production)

Configuration: Minify: On, XML Declaration: On

Output:

<?xml version="1.0" encoding="UTF-8"?><data><row><name>Alice</name><age>30</age></row></data>

XML Well-Formedness Rules

For XML to be valid, it must be well-formed:

RuleDescription
Single rootExactly one top-level element
Proper nestingAll elements properly closed in correct order
Matching tagsEvery <tag> has a matching </tag>
Attribute quotingAll attribute values in single or double quotes
No < in contentMust be escaped as &lt; or wrapped in CDATA
No & in contentMust be escaped as &amp; or wrapped in CDATA
Valid namesElement names start with letter or underscore
XML declarationIf present, must be first line

This tool generates well-formed XML by default.

Frequently Asked Questions (FAQ)

  • Does the tool upload my data to the server?

    No. All conversion happens locally in your browser using JavaScript. Your data never leaves your device.

  • What is the difference between Element Mode and Attribute Mode?

    Element Mode outputs data as child elements (<name>Alice</name>). Attribute Mode outputs data as attributes (<row name="Alice"/>). Use elements for data content; use attributes for metadata and IDs.

  • What is CDATA?

    CDATA (Character Data) is a section in XML that tells the parser to treat content as plain text without interpreting special characters. Use <![CDATA[...]]> to preserve HTML, code, or text with <, >, & characters.

  • Should I include the XML declaration?

    Yes, for standalone XML documents. The declaration (<?xml version="1.0"?>) tells parsers the XML version and encoding. Omit only when embedding XML fragments into larger documents.

  • What encoding should I use?

    Use UTF-8 unless you have a specific requirement. UTF-8 supports all Unicode characters and is the default for modern XML documents.

  • What are Root Element and Row Element?

    Root Element is the top-level container tag (e.g., <catalog>). Row Element is the tag for each data row (e.g., <book>). Choose names that describe your data.

  • Can I edit the data before converting?

    Yes. The built-in table editor lets you modify cells, transpose, deduplicate, find/replace, change case, and insert/delete rows and columns before generating XML.

  • What CSV formats are supported?

    Standard CSV with comma delimiters. The first row can be used as column headers (enable "First Row as Header").

  • Is there a file size limit?

    The tool processes data entirely in your browser. Files up to 10 MB typically convert without issues on modern hardware.

Featured Tools

Featured tools that you might find useful.

Popular Tools

List of popular tools that users love and frequently use.

New Tools

The latest tools added to our collection, designed for you.

Topics

The tools grouped by topics to quickly find what you need.
Free Markdown to ASCII table converter with 9 border styles, 13 code comment wrappers, text alignment, and row separators. Paste into any code file instantly.

Markdown To ASCII Table

Free Markdown to ASCII table converter with 9 border styles, 13 code comment wrappers, text alignment, and row separators. Paste into any code file instantly.
Free Markdown to AsciiDoc table converter. Generate AsciiDoc markup from Markdown tables with header, footer, title, and minify options.

Markdown To AsciiDoc Table

Free Markdown to AsciiDoc table converter. Generate AsciiDoc markup from Markdown tables with header, footer, title, and minify options.
Free Markdown to Avro Schema converter. Generate Apache Avro schema JSON from Markdown tables for Kafka, Hadoop, and Spark. Auto type detection. Runs in browser.

Markdown To Avro Schema

Free Markdown to Avro Schema converter. Generate Apache Avro schema JSON from Markdown tables for Kafka, Hadoop, and Spark. Auto type detection. Runs in browser.
Free Markdown to CSV converter with custom delimiters, quote wrapping, UTF-8 BOM for Excel, and row prefix/suffix. Edit tables visually. Runs in browser.

Markdown To CSV

Free Markdown to CSV converter with custom delimiters, quote wrapping, UTF-8 BOM for Excel, and row prefix/suffix. Edit tables visually. Runs in browser.