How to Convert XML to CSV (Step by Step)
You have an XML file. You need a table you can read, sort, and share. A CSV file gives you that table. This guide shows you how to convert XML to CSV, step by step, with a small real example.
You do not need to write code or install a program. You can use our free XML to CSV converter in your browser, check the result on screen, and then download the file.
What Is XML, in Plain Words?
XML is a way to store data in a text file. The name stands for Extensible Markup Language. The idea is simple, even if the name sounds hard.
XML uses tags. A tag is a word in angle brackets, like <name> and </name>. The first tag opens a part. The last tag closes it. Data sits in the middle.
Think of XML like labeled boxes. A big box can hold smaller boxes. Each box has a clear label. That makes XML good for sending data from one system to another. Many stores and apps use XML for product lists, orders, and feeds.
XML can also hold extra facts on the opening tag. Those facts are called attributes. An attribute is a name and a value inside the opening tag. For example, a product tag can hold an ID and a currency as attributes. Those facts are real data, and a good conversion must keep them.
There is one catch. XML is built like a tree, not like a table. A tree has branches at many levels. A table has flat rows and columns. To convert the file, you must choose which branch becomes a row, and which parts become columns. That choice is the key step.
What Is CSV, in Plain Words?
CSV is also a text file. The name stands for Comma-Separated Values. Each row is one line of text, and a comma splits the line into columns.
The first line is most often the header row. It holds the column names. Each line after that holds one record. A record is one full set of facts, like one product or one order.
CSV is simple. Almost every tool can open it. You can open CSV in Excel, Google Sheets, and many other apps. You can also load CSV into a database or shop software with ease.
CSV has no colors, no bold text, and no sheets. It holds data only. That plain style is a strength. The file stays small, clean, and easy to move.
A Small Worked Example
Here is a short XML file. It lists three products from a small store.
<?xml version="1.0" encoding="UTF-8"?>
<products>
<product id="BK-1001" currency="USD">
<name>Blue Notebook</name>
<price>8.50</price>
<stock>120</stock>
</product>
<product id="BK-1002" currency="USD">
<name>Red Pen Set</name>
<price>4.25</price>
<stock>300</stock>
</product>
<product id="BK-1003" currency="EUR">
<name>Desk Lamp</name>
<price>22.00</price>
<stock>45</stock>
</product>
</products>
The <products> tag is the big box. Each <product> tag is one item. Inside each product, you see a name, a price, and a stock count.
Note the facts on the <product> tag itself. Each product has an id and a currency. Those are attributes. If you lose them, you lose the product code and which money the price uses.
Now here is the CSV file you get. Each product becomes one row.
product@id,product@currency,name,price,stock
BK-1001,USD,Blue Notebook,8.50,120
BK-1002,USD,Red Pen Set,4.25,300
BK-1003,EUR,Desk Lamp,22.00,45
The attribute columns come first. A name like product@id means the id attribute on the product tag. The @ sign marks it as an attribute, not a child tag. The rest of the columns come from the child tags: name, price, and stock.
The same result as a table:
| product@id | product@currency | name | price | stock |
|---|---|---|---|---|
| BK-1001 | USD | Blue Notebook | 8.50 | 120 |
| BK-1002 | USD | Red Pen Set | 4.25 | 300 |
| BK-1003 | EUR | Desk Lamp | 22.00 | 45 |
Three products gave you three rows, plus one header row. That match is what you check each time. If the counts do not match, a step needs a fix.
Before You Start
Know how big your file is. On the Free plan, you can convert files up to 2 MB, for up to 10 conversions a month, and export up to 5,000 rows. Starter allows files up to 25 MB and 300 conversions a month. Pro allows files up to 100 MB and 2,000 conversions a month.
Think about what one row should be. In the example, one row is one product. In an order file, one row might be one order, or one item in an order. The right choice fits the work you plan to do with the table.
Keep a copy of your first XML file. Work on a copy, so you can always go back and try again.
Step 1: Check That the File Opens and Is Valid
Open your XML file in a plain text app first. You should see tags, text, and a clear start and end. If the file looks like random signs, it may not be XML, or it may be zipped. Unzip it first if you need to.
A valid XML file follows strict rules. Each opening tag needs a closing tag. Tags must nest in the right order, like boxes placed one inside the next. Quote marks must wrap each attribute value.
If your file is broken, you need to know where. On XmlToCsv, a broken file gives a clear error with the line number and the column number. That tells you the exact spot to look at. Some rival tools, such as ConvertCSV, fail with no message at all on a bad file. A clear error saves time, because you can fix the one bad spot and run the file again.
Fix small faults at the source if you can. Close the missing tag. Fix the wrong quote mark. Then save the file and move on.
Step 2: Upload the File or Paste the Text
Go to the tool and add your file. You can upload the file from your device. For a very small file or a short test, you can also paste the XML text in by hand.
Large files are handled with care. The tool reads the file in small pieces, not all at once. This way of working is called streaming. Streaming means the tool does not need to load the whole file into memory at one time. That helps big files run with less risk of a crash.
If your file is huge, test with a small cut of it first. A test with ten or twenty records shows you the columns you will get. Once the test looks right, run the full file with the same settings.
Step 3: Let the Tool Find the Row Element
This is the most key step. The row element is the repeating tag that becomes one row. In our example, the row element is product, because that tag repeats once for each item.
The tool finds the row element for you. It picks the tag that repeats in a clear pattern. In most files, the auto choice is right.
Still, check the pick. Ask: does one tag of this type equal one row I want? If yes, keep it. If no, change it. You can pick a different tag from the list, or type a path by hand. A path is the chain of tags from the top of the tree down to your row tag. A path helps when your file has groups inside groups, like orders that each hold many items.
For more help, read our guide and pick the right row element for your file shape. A wrong row choice is the top cause of odd results, like too many rows or too few columns.
Step 4: Check the Preview
Do not download yet. First, look at the table preview. The preview shows the first rows of your result on screen, before you save a file.
Check these points:
- Do the column names make sense?
- Does each row hold one full record?
- Are the values in the right columns?
- Do you see data for all the main tags you care about?
Scan at least five to ten rows, not just the first one. Some faults show up only in later rows. A product with no stock tag may leave a blank cell, which is fine. But a price under the name column is not fine. That points to a wrong row element.
Change the setting, run it again, and look once more. Two minutes here beats a long clean-up in a spreadsheet later.
Step 5: Keep the Attribute Columns
Look for columns with an @ in the name, like product@id. Those columns came from attributes. Keep them unless you are sure you do not need them.
An attribute often holds the most key fact in the file: the ID code that links a row to other files. If you drop the ID, you may not be able to match the rows back to your shop or stock list.
In our example, the price makes full sense only with the currency next to it. A price of 22.00 in USD is not the same as 22.00 in EUR. The attribute column keeps that fact safe.
If a column name is long, you can shorten it in the next step. Do not delete a column just because its name looks odd. Check what it holds first.
Step 6: Rename or Remove Columns
Now shape the table for the people who will use it. Rename a column to a name your team knows. For example, rename product@id to SKU, or rename price to Unit Price.
You can also remove columns you do not need. If the file holds a code that no one uses, take it out. A short, clean table is easier to read and share.
Use clear names with no commas in them. Keep each name short. Use the same names each time you convert the same kind of file, so later work stays smooth.
If you convert the same kind of file each week or month, paid plans can save your choices as a field mapping template. A template saves your renamed and removed columns, so you do not have to set them up again. You pick the template, and the same rules apply to the new file.
Step 7: Choose CSV and Download
When the preview looks right, choose CSV as the format and download the file. Save it with a clear name that includes the date or the source. A name like products-2026-11-06.csv is easier to find than output.csv.
Note your row count before you close the page. You will check this count in the next step.
If you have many files of the same kind, note the batch limits. Starter lets you convert a batch of 10 files at once. Pro lets you convert a batch of 50 files at once.
Step 8: Open the File in a Spreadsheet and Check the Counts
Open the CSV file in Excel, Google Sheets, or the app you use most. The table should look the same as the preview.
Now do three quick checks:
- Count the data rows. The count should match the number of row elements in your XML. In our example, three products must give three data rows.
- Check the header row. Each column should have one clear name, with no blank names and no repeat names.
- Spot-check a few values. Pick one row and match each value back to the XML by hand. Check the ID, the name, and the price.
Also check text that holds commas. A name like Lamp, Desk needs quote marks around it in CSV, or the comma will split it into two columns. A good tool adds those quote marks for you.
Once the checks pass, your conversion is done. Keep the CSV and the first XML file together, so you can trace any row back to its source.
What to Do With Repeated Values
Some XML files hold lists inside one record. One product may have three tags, or one order may have four notes. A flat table must place those list values with care.
You have two choices on XmlToCsv. You can join the values in one cell with "; " between them. One product with the tags sale, new, and cotton becomes one cell that reads sale; new; cotton, and the record stays on one row. Or you can expand the values to one row per value. The same product becomes three rows, one for each tag, and the other facts repeat on each row.
Pick the joined style when you want one neat row per record. Pick the expanded style when you plan to count, filter, or chart each value on its own.
Common Problems and How to Fix Them
The Table Has Too Many Rows
You may have picked a row element that sits too low in the tree. If you pick an item tag inside each order, you get one row per item, not one row per order. Go back to Step 3 and pick the higher tag.
The Table Has Too Few Columns
Some records may miss tags that other records have. Check a later part of your file to see if new tags appear. If your data has mixed shapes, you may need to clean the source file first, or split it into two files with like shapes.
Data Looks Lost or Blank
Blank cells do not always mean lost data. A tag may be empty in the source, or a record may not have that tag at all. Open the XML and find that record to check. To learn more, read about why conversions lose data and how to fix it before you change your file.
Text Shows Odd Signs
Words with marks like é or ü may show as odd signs if the file uses one text code and the app reads a different code. This code is called the encoding. Most XML files use UTF-8, the most common code. If your XML names a different code at the top, open the CSV in an app that lets you pick the code, and pick the same one.
Numbers Turn Into Dates or Lose Zeros
A spreadsheet app may read a code like 00123 and show 123. That is a spreadsheet issue, not a fault in the CSV itself. Open the raw CSV in a text app to see the true values. In your spreadsheet, set those columns to Text format before you import, if the codes matter.
A Quick Look at Plans
All plans give you CSV and XLSX export and the on-screen preview. The differences are file size, how many conversions you can run, and batch size.
| Plan | Price | Conversions per month | Max file size | Batch size | Export rows |
|---|---|---|---|---|---|
| Free | $0 | 10 | 2 MB | 1 | Up to 5,000 rows |
| Starter | $9/month | 300 | 25 MB | 10 | — |
| Pro | $19/month | 2,000 | 100 MB | 50 | — |
Paid plans also let you save field mapping templates for reuse. If you run the same conversion each week, that feature can save real time. If you convert one file once in a while, the Free plan may be all you need.
Frequently Asked Questions
Do I need to know how to code?
No. The steps above use clicks, picks, and short typing only. You pick the file, check the preview, rename columns if you want, and download.
What is the row element, in one line?
The row element is the repeating tag that becomes one row in your table. In a product file, it is most often the product tag. In an order file, it may be the order tag or the item tag, based on the table you want.
Will I lose my attributes?
No, not if you keep the attribute columns. On XmlToCsv, attributes are kept as columns with names like product@id. You can rename those columns, but do not delete them until you check what they hold.
What if my XML has errors?
You will get an error that names the line and the column of the fault. Fix that spot in the file, save it, and run the conversion again. Most faults are a missing closing tag or a wrong quote mark.
Can I convert more than one file at once?
Yes, on paid plans. Starter supports a batch of 10 files. Pro supports a batch of 50 files. Use the same row element and mapping for all files in the batch, so the results match.
Should I pick CSV or Excel for my result?
Pick CSV if your next step is an import into other software, a database, or a shop system. Pick Excel if you need formatting, totals, or more than one sheet. If you are not sure, make the CSV first, check it, and then convert the same file to Excel instead if your team asks for a spreadsheet file.
Final Checklist
Before you share your CSV file, run through this short list:
- The row count matches the count of records in the XML.
- The header names are clear, with no blanks or repeats.
- Attribute columns, like the ID, are still in the table.
- A few rows match the source XML when checked by hand.
- Values with commas sit in one cell, not split in two.
- The file name is clear and holds the date or source.
If each point passes, your file is ready to use.
References
- https://www.w3.org/TR/xml/ — The XML specification from the W3C, the group that defines how XML works.
- https://www.rfc-editor.org/rfc/rfc4180 — RFC 4180, the common definition of the CSV format, including header rows and quote rules.