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.
Convert XML to CSV
Your XML data
CSV preview
Shows up to 20 rowsChoose or paste XML to see which data you can convert.
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.
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.
How to Convert XML to CSV
Choose or paste XML
Choose an .xml file or paste XML data into the box above.
Choose rows and CSV settings
Select the XML entries that should become rows. Review nested fields, attributes, column separator, and UTF-8 encoding.
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.
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.
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,ChicagoDownload sample XML Download sample CSV
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.
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.
| Input | XML file (.xml) or pasted XML text, read as UTF-8 |
|---|---|
| Output | CSV (.csv) |
| Maximum XML input | 10 MB |
| XML structure | Up to 100,000 elements and 128 nesting levels |
| Maximum CSV cells | 2 million cells, including the header row when selected |
| Data groups shown | Up to 12 groups listed automatically; enter an XML path for other entries |
| Nested elements | Show as columns such as address.city, or combine as text |
| Attributes | Include or exclude attribute columns such as @id |
| Repeated fields | Combine values or use only the first value |
| CSV separator | Comma, semicolon, tab, or pipe |
| Encoding | UTF-8 or UTF-8 with BOM (recommended for opening directly in Excel) |
| Column headings | Optional first row |
| Privacy | Local conversion in the browser; no account required |
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 XML | CSV result | What to check |
|---|---|---|
Repeated <customer> entries | One row per selected customer | Choose the correct data group |
Attribute id="00123" | Column @id | Keep Include XML attributes selected |
Nested address/city | Column address.city | Turn on Show nested fields as columns |
| Repeated simple values | Combined with | , or only the first | Read the warning before downloading |
| Repeated nested items | Several items may be combined into one row | Choose the nested data group for separate rows |
| XML namespaces | Distinct labels such as ns1:id and ns2:id | Column labels may differ from those in the original XML |
| Text mixed with nested elements | Values placed in separate columns | Original reading order is not retained |
| Comments, formatting and XML structure | Not saved as XML in the CSV | Keep 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.
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:loc | ns1:lastmod |
|---|---|
| https://example.com/page-a | 2026-10-01 |
| https://example.com/page-b | 2026-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.
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.
Common XML to CSV Conversion Problems
| Problem | What to try |
|---|---|
| Wrong XML entries become rows | Choose another data group or enter its XML path (advanced). |
| Nested values are in one CSV column | Turn on Show nested fields as columns. |
| Missing XML attribute | Keep Include XML attributes selected. |
| Several values appear together | Repeated values are combined by default. Choose a nested group if each item needs its own row. |
| All data appears in one column in Excel | Check the CSV column separator and Excel's import delimiter. |
| Accented characters are garbled | Try UTF-8 with BOM, or import the CSV using UTF-8 in Excel. |
| Leading zeros disappear in Excel | Import those columns as Text. The original CSV value can still contain the zeros. |
| XML cannot be read | Check closing tags, XML entities and unsupported DOCTYPE sections. |
| XML file is too large | Split it into smaller XML files or choose fewer records. |
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
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.
Related Data Converters
Ready to convert XML to CSV?
Paste XML or choose a file and convert it locally in your browser.