World’s largest virtual agentic engineering & quality conference

WHENAUG 19-21
WHEREVirtual · Global
Register Now

XML to CSV Converter Online

This free tool allows you to convert XML data to CSV in your browser. Paste or upload XML and download a CSV file instantly. It is brought to you by TestMu AI (formerly LambdaTest), the team behind a unified software testing platform.

Categories

...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free
...
TestMu Conf 2026

World's largest virtual agentic engineering & quality conference

...

AUG 19-21, 2026

REGISTER NOW

Input

Paste well-formed XML with repeating record elements. Nested tags become dotted columns.

Separates CSV columns. Tab downloads as .tsv.

Converts as you type or change the delimiter.

ConvertConvert to CSV

Output

XML and CSV are two common file formats that store and transfer data. XML is a markup language used to describe data in a hierarchical structure. CSV is a simple text format used to store tabular data. When you need to convert data from one format to another, tools are available for the job. An XML to CSV converter is an online tool that converts data in XML format to data in CSV format. The converter reads the XML file, parses it, extracts the relevant data, then formats it in CSV format, which can be saved as a new file or output to the console.

There are several reasons why you might want to convert data from XML to CSV format. These reasons include CSV files are:

  • Easier to read and edit than XML files.
  • Can be opened in a spreadsheet program such as Microsoft Excel, which makes it easy to view and manipulate the data.
  • More lightweight than XML files.
  • More widely supported than XML files.

How to Convert XML to CSV in Microsoft Excel

If you prefer a spreadsheet, Microsoft Excel can import an XML file, flatten it into a table, and export it as CSV. The exact menu depends on your Excel version.

Microsoft 365 (Get Data / Power Query)

  • On the Data tab, click Get Data → From File → From XML.
  • Select your .xml file and click Import.
  • In the Power Query Navigator preview, click Load to place the data on a sheet as an Excel Table, or Transform Data first to clean it, then Home → Close & Load.
  • Go to File → Save As and choose "CSV (Comma delimited) (*.csv)", or "CSV UTF-8 (Comma delimited) (*.csv)" to preserve accented characters, then Save.

Excel 2016 and earlier

Open the Data tab, click From Other Sources → From XML Data Import, choose your file, and click Open. If Excel warns that "The specified XML source does not refer to a schema", click OK so Excel builds a schema from the data, then pick "XML table in existing worksheet" or "XML table in new worksheet". Finally, use Save As → "CSV (Comma delimited) (*.csv)".

Excel turns repeating elements into rows and child tags into columns. Deeply nested or irregular XML may need the Transform Data step (in Power Query) to expand nested columns first. Saving as CSV keeps only the active sheet, and in some regional settings "CSV (Comma delimited)" follows your system list separator. If you need true commas, use the CSV UTF-8 option. On a Mac, Get Data → From XML requires Excel for Microsoft 365 version 16.69 or later, and the Developer-tab XML tools are Windows-only.

Convert XML to CSV Programmatically (Python & Node.js)

For large files, automation, or batch jobs, a short script is a reliable route. Both examples below quote fields correctly and let you choose the delimiter.

Convert XML to CSV with Python

The quickest path uses pandas' read_xml() function (added in pandas 1.3):

import pandas as pd

# pandas.read_xml() uses the lxml package by default (pip install lxml),
# or pass parser="etree" to use Python's built-in parser for simple XML.
df = pd.read_xml("books.xml")
df.to_csv("books.csv", index=False)  # comma-delimited; quotes fields automatically

For more control, the standard library's xml.etree.ElementTree walks the tree while Python's csv module writes RFC 4180-compliant output. It automatically wraps any value containing a comma, quote, or line break in double quotes:

import csv
import xml.etree.ElementTree as ET

root = ET.parse("books.xml").getroot()

# One dict per record, using each direct child tag as a column.
rows = [{child.tag: child.text for child in record} for record in root]

# Header = the union of every record's tags, so ragged records stay aligned.
fieldnames = list({key: None for row in rows for key in row})

with open("books.csv", "w", newline="", encoding="utf-8") as f:
    writer = csv.DictWriter(f, fieldnames=fieldnames, restval="")
    writer.writeheader()
    writer.writerows(rows)

Both write comma-delimited CSV. Pass delimiter=";" to csv.DictWriter (or sep=";" to to_csv) when you need a semicolon file.

Convert XML to CSV with Node.js

Node has no built-in XML parser, so combine fast-xml-parser with json2csv:

// npm install fast-xml-parser @json2csv/plainjs
const fs = require("fs");
const { XMLParser } = require("fast-xml-parser");
const { Parser } = require("@json2csv/plainjs");

const data = new XMLParser().parse(fs.readFileSync("books.xml", "utf8"));

// fast-xml-parser returns an object for a single record and an array for
// many, so normalise to an array before converting. Adjust the path below.
const rows = [].concat(data.library.book);

fs.writeFileSync("books.csv", new Parser().parse(rows));

How to Convert XML to CSV Using Notepad++

Notepad++ has no built-in XML-to-CSV command, but the free XML Tools plugin adds one reliable route, and Find & Replace covers simple cases.

Method 1: XML Tools plugin (recommended)

  • Go to Plugins → Plugins Admin, open the Available tab, search for "XML Tools", tick it, and click Install (Notepad++ restarts to finish).
  • Open your XML file, then choose Plugins → XML Tools → XSL Transformation.
  • Point it at an XSLT stylesheet whose output method is text and that emits one comma-separated line per record. A minimal stylesheet for the sample above looks like this:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="text" />

  <xsl:template match="/library">
    <xsl:text>isbn,title,author,genre&#10;</xsl:text>
    <xsl:apply-templates select="book" />
  </xsl:template>

  <xsl:template match="book">
    <xsl:value-of select="isbn"/>,<xsl:value-of select="title"/>,<xsl:value-of select="author"/>,<xsl:value-of select="genre"/><xsl:text>&#10;</xsl:text>
  </xsl:template>
</xsl:stylesheet>

Run the transformation and save the result with a .csv extension.

Method 2: Find & Replace (simple, flat XML only)

For small, flat XML you can use Search → Replace with the Search mode set to "Regular expression" to turn closing-then-opening tags into commas, record boundaries into new lines, and then strip the remaining tags. This is quick but fragile. It has no understanding of XML structure, so it breaks on nested elements or on any value that itself contains a comma. For anything beyond trivial, flat data, use the XSLT method above, Excel, or a script.

Handling Complex XML: Nested Tags, Delimiters & Quotes

The converter on this page works best with XML that has a repeating record element. Nested child tags become dot-notation columns, and attributes become their own columns. For example, this input:

<?xml version="1.0" encoding="UTF-8" ?>
<library>
  <book>
    <isbn>978-3-16-148410-0</isbn>
    <title>The Great Gatsby</title>
    <author>F. Scott Fitzgerald</author>
    <genre>Fiction</genre>
  </book>
  <book>
    <isbn>978-0-14-118263-6</isbn>
    <title>To Kill a Mockingbird</title>
    <author>Harper Lee</author>
    <genre>Historical Fiction</genre>
  </book>
</library>

produces this CSV, where each <book> becomes a row and each child tag becomes a column heading:

isbn,title,author,genre
978-3-16-148410-0,The Great Gatsby,F. Scott Fitzgerald,Fiction
978-0-14-118263-6,To Kill a Mockingbird,Harper Lee,Historical Fiction

Nested tags and attributes

If a record contains nested child elements (a tag inside a tag), this converter flattens them into dotted column names such as dimensions.width. XML attributes on a record or nested element become columns named with an @ prefix, for example @id or dimensions.@unit. For very deep or irregular trees, Excel Power Query's Transform Data step or the Python/Node scripts above give you more control over which levels become columns.

Delimiters

Use the Delimiter control above the Convert button to choose comma, semicolon, or tab. Semicolon suits some European spreadsheets. Tab downloads as a .tsv file. You can also set the delimiter in the Python or Node scripts if you automate the conversion.

Commas and quotes inside values

In CSV, a comma always separates fields, so any value that itself contains a comma, a double quote, or a line break must be wrapped in double quotes, with embedded quotes doubled. This is the RFC 4180 rule. This converter applies that quoting automatically for the selected delimiter. Open the CSV in a spreadsheet to confirm the columns line up.

What is an XML to CSV converter?

An XML to CSV converter is an online tool that converts data in XML format to data in CSV format.

How can you ensure the resulting CSV file is formatted correctly?

After you create a CSV file, test it to make sure the data was formatted correctly and all information was extracted. If problems arise, you might have to adjust the conversion process or manually edit the CSV file.

Are there any limitations to XML to CSV conversion?

XML to CSV conversion may not be suitable for all types of data, such as data that requires nested structures or complex relationships between data elements. Additionally, some formatting or metadata may be lost during the conversion process.

Frequently Asked Questions

Did you find this page helpful?

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests