Free online data converter

XML to CSV Converter

Choose an XML file or paste XML text, select which entries become CSV rows, and download a UTF-8 file. Nested fields and attributes can become columns. Your XML stays in your browser.

Files stay on your device Nested fields as columns UTF-8 CSV options
Free online tool

Convert XML to CSV

Files stay in your browser

Your XML data

CSV preview

Shows up to 20 rows

Choose or paste XML to see which data you can convert.

For CSV files opened in Excel: adds a leading apostrophe to values that may be treated as formulas (starting with =, +, - or @). This changes those values and does not guarantee protection in every spreadsheet app.

Quick answer

How to Convert XML to CSV Online

Choose an XML file or paste XML text into the converter. Select the XML entries you want as CSV rows, and choose whether to include nested fields and attributes as columns. Click Convert XML to CSV, check the preview and any warnings, then download the CSV file.

Private by design

Your XML file never leaves this tab

Check the CSV preview in your browser before downloading. The original XML file is not changed.

Processed locally

Your XML file is read and converted right here in this browser tab.

No account required

No account, email address, or payment details required.

Your original XML stays intact

The converter creates a new CSV file without changing the XML you selected.

No upload: your file is converted in this tab. We do not receive your file name or file content.
Three steps

How to Convert XML to CSV

1

Choose or paste XML

Choose an .xml file or paste XML data into the box above.

2

Choose rows and CSV settings

Select the XML entries that should become rows. Review nested fields, attributes, column separator, and UTF-8 encoding.

3

Download the converted CSV

Click Convert XML to CSV, review the table and any warnings, then download a file for your spreadsheet or data tools.

Customize your file

Choose How Your CSV Is Created

Nested fields as columns

Details inside XML entries can become columns such as address.city and address.zip.

XML attributes

Convert XML elements and attributes into CSV columns, including attributes such as @id.

Column separators

Separate CSV columns using a comma, semicolon, tab, or pipe, depending on where you plan to use the file.

Encoding and column headings

Choose UTF-8 or UTF-8 with BOM, and decide whether the first row contains column names. A BOM can help Excel display international characters correctly. See our UTF-8 CSV guide.

Example

XML to CSV Example: Two Customer Records

Choose the customers.customer entries as CSV rows. Each customer's ID, name, and city become separate columns. The original ID text, including leading zeros, stays in the CSV.

XML input

<?xml version="1.0" encoding="UTF-8"?>
<customers>
  <customer id="00123"><name>Alice</name><city>New York</city></customer>
  <customer id="00124"><name>Bob</name><city>Chicago</city></customer>
</customers>

CSV output

@id,name,city
00123,Alice,New York
00124,Bob,Chicago

The CSV contains the text 00123, but Excel may display it as 123 if you open the CSV directly. Import that column as text when you need to preserve the zeros in Excel.

Formats and limits

XML to CSV Supported Formats and File Limits

This tool turns valid XML into CSV rows and columns. The limits below apply to this converter, not to CSV files in general.

InputXML file (.xml) or pasted XML text, read as UTF-8
OutputCSV (.csv)
Maximum XML input10 MB
XML structureUp to 100,000 elements and 128 nesting levels
Maximum CSV cells2 million cells, including the header row when selected
Data groups shownUp to 12 groups listed automatically; enter an XML path for other entries
Nested elementsShow as columns such as address.city, or combine as text
AttributesInclude or exclude attribute columns such as @id
Repeated fieldsCombine values or use only the first value
CSV separatorComma, semicolon, tab, or pipe
EncodingUTF-8 or UTF-8 with BOM (recommended for opening directly in Excel)
Column headingsOptional first row
PrivacyLocal conversion in the browser; no account required
What changes

What XML Information Is Preserved When Converted to CSV?

XML has nested elements and attributes, while CSV has only rows and columns. Each selected XML entry can become a CSV row, but some relationships between nested items may be lost.

Original XMLCSV resultWhat to check
Repeated <customer> entriesOne row per selected customerChoose the correct data group
Attribute id="00123"Column @idKeep Include XML attributes selected
Nested address/cityColumn address.cityTurn on Show nested fields as columns
Repeated simple valuesCombined with | , or only the firstRead the warning before downloading
Repeated nested itemsSeveral items may be combined into one rowChoose the nested data group for separate rows
XML namespacesDistinct labels such as ns1:id and ns2:idColumn labels may differ from those in the original XML
Text mixed with nested elementsValues placed in separate columnsOriginal reading order is not retained
Comments, formatting and XML structureNot saved as XML in the CSVKeep your original XML if you need to reconstruct it

Spaces at the start and end of an XML value are removed, but spaces and line breaks within the value are kept. Values containing the selected separator, quotation marks, or line breaks are enclosed in quotes where needed.

Sitemaps

Convert Sitemap XML to CSV

Turn sitemap URLs and last-modified dates into a CSV table. Select the url entries as rows. In this sample, they appear under ns1:urlset.ns1:url, and the columns are named ns1:loc and ns1:lastmod because the XML uses a namespace.

Complete Sitemap XML

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url><loc>https://example.com/page-a</loc><lastmod>2026-10-01</lastmod></url>
  <url><loc>https://example.com/page-b</loc><lastmod>2026-10-15</lastmod></url>
</urlset>

CSV output

ns1:locns1:lastmod
https://example.com/page-a2026-10-01
https://example.com/page-b2026-10-15

For a sitemap index, select the sitemap entries inside sitemapindex instead. Sitemap changefreq and priority fields may be exported when present, but Google does not use them for crawling decisions. Learn more from the Sitemap protocol.

Excel compatibility

Open UTF-8 CSV in Excel Without Losing Text

Choose UTF-8 with BOM if you plan to open your CSV directly in Excel. A BOM can help Excel recognize accented or non-Latin characters, but it does not stop Excel from interpreting identifiers, large numbers or dates.

To keep values such as 00123 unchanged in Excel, use Data → From Text/CSV and set the relevant columns to Text before loading. If you want a native spreadsheet without an intermediate CSV file, try the XML to Excel converter.

Prevent unwanted formulas when opening CSV in Excel

If your XML contains a value beginning with =, +, - or @, some spreadsheet apps may treat that CSV text as a formula. The optional Reduce spreadsheet formula risks setting adds an apostrophe to such values, including negative numbers. It changes the CSV contents and is only a mitigation—not a guarantee of safety in every spreadsheet program. Leave it off if you need raw, unchanged CSV data. For more encoding advice, see our Excel UTF-8 CSV guide.

Troubleshooting

Common XML to CSV Conversion Problems

ProblemWhat to try
Wrong XML entries become rowsChoose another data group or enter its XML path (advanced).
Nested values are in one CSV columnTurn on Show nested fields as columns.
Missing XML attributeKeep Include XML attributes selected.
Several values appear togetherRepeated values are combined by default. Choose a nested group if each item needs its own row.
All data appears in one column in ExcelCheck the CSV column separator and Excel's import delimiter.
Accented characters are garbledTry UTF-8 with BOM, or import the CSV using UTF-8 in Excel.
Leading zeros disappear in ExcelImport those columns as Text. The original CSV value can still contain the zeros.
XML cannot be readCheck closing tags, XML entities and unsupported DOCTYPE sections.
XML file is too largeSplit it into smaller XML files or choose fewer records.
Format basics

XML vs CSV: Which Should You Use?

XML

  • Tree-shaped data with nested elements
  • Attributes on elements
  • Good for structured documents and feeds

CSV

  • Two-dimensional rows and columns
  • Easy to open in spreadsheet apps
  • Works well for imports, analysis, and AI uploads
Good to know

Frequently Asked Questions

How do I convert XML to CSV online?

Choose an XML file or paste XML text, select the entries that should become rows, and click Convert XML to CSV. Check the preview and download the CSV file.

Can I convert a single XML record to CSV?

Yes. Even if your XML contains just one customer, you can create one CSV row. If it is not listed, enter its location in the XML path (advanced) field.

Can nested XML become CSV columns?

Yes. Leave Show nested fields as columns selected to create columns such as address.city and address.zip. When nested items repeat, some values may be combined in a single CSV row.

How are XML attributes converted to CSV?

When Include XML attributes is selected, attributes become columns such as @id or price.@currency. You can turn this off if you do not need them.

What happens to repeated XML values?

Repeated simple values are combined in one cell with a vertical bar by default. You can keep only the first value instead, but the remaining values are omitted. Read any data warnings before downloading.

Can I convert XML sitemap files to CSV?

Yes. Choose the sitemap URL entries as rows and download their URL and date fields, including loc and lastmod when present. A regular sitemap contains url entries, while a sitemap index contains sitemap entries. You may see column names such as ns1:loc if the XML uses namespaces.

Does converting XML to CSV preserve leading zeros?

The CSV contains the original text such as 00123. However, Excel may change that value when opening CSV directly. Use Excel's text import options if you need to keep identifiers as text.

Does the CSV support UTF-8 and Excel?

Yes. Choose UTF-8 for a plain CSV or UTF-8 with BOM for better compatibility when opening the file in Excel. A BOM helps encoding detection but does not prevent Excel from changing cell types.

What are the file size and processing limits?

XML input is limited to 10 MB, 100,000 elements and 128 nesting levels. The tool limits CSV output to 2 million cells and lists up to 12 detected data groups; you can enter an XML path in the advanced field.

Can XML text become a spreadsheet formula?

Some spreadsheet programs interpret CSV values starting with =, +, - or @ as formulas. Optional spreadsheet protection adds an apostrophe before affected values. This changes the data and is not a guarantee of safety in every spreadsheet app.

Is my XML uploaded to a server?

No. The tool reads and converts XML in your browser. Your XML file and its contents are not uploaded to our servers.

More converters

Related Data Converters

Ready to convert XML to CSV?

Paste XML or choose a file and convert it locally in your browser.

Go to converter