How to Convert a Large XML File (100 MB+) Without Running Out of Memory

A large XML file can stop a normal tool cold. The file opens. The wheel spins. Then the tool freezes, or the tab closes, or you get no file at all. Most tools were built for small files. A big file needs a different way of working.

This guide shows how to make convert large xml file to csv work in a safe way. You will learn why big files use so much memory, what streaming means in plain words, and a clear plan to follow, even if your file is close to 100 MB.

XML is a text format for data. It uses tags to name each piece of data. A tag is a word in angle brackets, like <price>. CSV is a simple table format. Each line is one row, and commas split the row into columns.

Why Big XML Files Are So Hard

Size alone is not the whole problem. A 50 MB XML file does not just need 50 MB of room to work. In many tools, it needs much more.

When a tool loads a file the old way, it reads the whole file at once. It builds a full map of the file in memory. Memory is the fast, short-term space a computer uses while it works. That map often takes many times the size of the file itself. Each tag, each value, and each link between them gets its own small object in memory. Those objects add up fast.

Then the tool may make more copies: a table from the map, a preview from the table, and the final file from the preview. The old copy may still sit in memory while the new copy is made, so a file can fill all free memory in seconds. When memory runs out, the tool may slow down, close with no warning, or crash the browser tab. Small files hide this problem. A file near 100 MB can break a load-all tool every time.

Why Spreadsheets Struggle Too

You might try to open the XML file in Excel first. That path has its own limits.

Excel is a spreadsheet program made by Microsoft. A spreadsheet is a grid of rows and columns. Excel is great for viewing tables of a normal size. It is not built to be a converter for very large files.

First, Excel also loads the file into memory. It tries to guess the shape of your data and build a sheet from it. With a big file, that work is slow, and the program may freeze before you see a single row.

Second, a sheet has a hard row limit. An Excel worksheet can hold at most 1,048,576 rows. If your file has more records than that, the rest cannot fit on one sheet. They will be cut off or fail to load.

Third, an XLSX file is not plain text. XLSX is the file format Excel saves. It is a packed file with many parts inside. Making it takes extra work and extra memory.

Convert first, in a light format. View later, in a sheet, if the result fits. If you are not sure which output fits your task, read when to pick Excel output instead of CSV.

What Streaming Means, in Plain Words

Streaming is a way of reading a file in small pieces. The tool does not load the whole file at once. It reads a small piece, does its work, writes the result, and then lets that piece go. Think of it like drinking from a hose, not filling a tank. The water flows through. You do not need a tank big enough to hold it all.

Here is the same idea for a converter:

  1. The parser reads a small piece of XML. A parser is the part of a tool that reads a format and makes sense of it.
  2. When the parser has one full record, it turns that record into one row.
  3. The tool writes that row to the CSV file right away.
  4. The tool lets go of that record from memory.
  5. The tool moves on to the next record.

Because rows are written as the tool goes, memory stays roughly flat. Flat means it stays near the same level. It does not grow with the size of the file. A 10 MB file and a 90 MB file can use close to the same amount of memory. The big file just takes more time.

Streaming trades a fast crash for a steady job that finishes. XmlToCsv uses streaming: the parser reads the file in small pieces and writes rows as it goes.

A Small Example First

Here is a short XML file with three product records. A record is one full item in the data, like one product. The repeating tag here is <product>. That repeating tag is called the row element. The row element is the tag that marks the start and end of each record.

<?xml version="1.0" encoding="UTF-8"?>
<products>
  <product id="p101">
    <name>Blue Mug</name>
    <price>12.50</price>
    <stock>40</stock>
  </product>
  <product id="p102">
    <name>Red Plate</name>
    <price>9.00</price>
    <stock>15</stock>
  </product>
  <product id="p103">
    <name>Green Bowl</name>
    <price>11.25</price>
    <stock>0</stock>
  </product>
</products>

Notice the id on each product tag. That is an attribute. An attribute is a name and value placed inside the opening tag itself, not between tags. XmlToCsv keeps attributes as columns, named like product@id. That way, no data is lost just because it was stored as an attribute.

Here is the CSV result:

product@id,name,price,stock
p101,Blue Mug,12.50,40
p102,Red Plate,9.00,15
p103,Green Bowl,11.25,0

Each product became one row. Each field became one column. The same flow works for three rows or for three hundred thousand rows.

Three Ways to Handle a Large File

This table sums up the three common paths.

ApproachHow it worksMemory useBest for
Open in ExcelThe sheet program loads the file and builds a gridGrows fast, and stops at 1,048,576 rowsSmall files you want to view at once
Load-all converterThe tool loads the whole XML file, then writes the outputGrows with file size, often to many times the file sizeSmall to medium files
Streaming converterThe tool reads small pieces and writes rows as it goesStays roughly flat as the file growsLarge files near the plan limit

If your file is large, the third path keeps memory flat.

A Practical Plan for a Large File

Step 1: Convert to CSV, Not XLSX

For a large job, pick CSV as the output. CSV is plain text, and writing plain text is light work. The converter can write one line at a time and move on. XLSX takes more work to build, and it has the sheet row limit. You can open a finished CSV in a spreadsheet later, or split it first if it is too big for one sheet.

If this is your first conversion, the plain step-by-step for converting XML to CSV walks through each screen.

Step 2: Let the Tool Find the Row Element

XmlToCsv auto-detects the row element. It finds the tag that repeats as records. In most files, that guess is right. If it is wrong, you can pick another tag, or type a path to the tag you want. A path names a tag by where it sits in the file. A wrong pick can make far too many rows, or the wrong columns, so check it before the full job.

Step 3: Check the Preview and the Row Count

Before you download, look at the preview. A preview is a short look at the result before you take the full file. XmlToCsv shows the first rows plus the total row count.

The first rows tell you if the columns look right. Check the names, check that values sit in the right columns, and check that attribute columns, like product@id, show up if your file uses attributes.

The total row count tells you the true size of the job. If it is far off from what you expect, stop and fix the row element pick. Do not download a huge file you know is wrong. If the count is over the Excel sheet limit, plan to split the CSV or work with it in parts.

Step 4: Work in Batches if You Need To

A batch is a smaller group you handle on its own. Working in batches means you do not have to hold or check the whole result at once.

You can convert the full file to CSV once, then open just the first part to check it. You can also split a large CSV into smaller files by row count for your team, so each person checks one part.

Paid plans can save field mapping templates. A field mapping is your choice of which fields become which columns. A template saves that choice so you can use it again, and keeps each batch in the same columns, in the same order.

Step 5: Keep the Source Safe

Keep your source XML file unchanged. Work on a copy if you plan to trim or split it, so you can start over if a step goes wrong. Save the CSV with a clear name that shows the date or the batch.

What the Plan Size Limits Mean

PlanPriceConversionsFile size limitExport note
Free$010 per monthUp to 2 MBExport up to 5,000 rows
Starter$9 per month300 per monthUp to 25 MBCSV and XLSX exports
Pro$19 per month2,000 per monthUp to 100 MBCSV and XLSX exports

The free plan fits tests and small files. If your file is 40 MB, you need the Pro plan, because it goes up to 100 MB. A 40 MB file will not fit in the free or Starter limits, no matter how well streaming works. Streaming keeps memory flat, but the plan limit is still a hard cap.

You can see the plan size limits on the pricing page before you upload.

What to Do With a File Above 100 MB

What if your file is even bigger than 100 MB? You still have good options, with any tool.

Split the File at Record Boundaries

You can split one huge file into two or more smaller files. The key rule is to split at record boundaries. A boundary is the line between two full records, where one record ends and the next one begins.

Never cut in the middle of a record. A cut in the middle leaves both parts broken. Cut only where a record tag has fully closed and the next one has not yet started.

Each part also needs the same start and end as a valid XML file: the XML declaration at the top if the source has one, and the same root element tags around its records. The declaration is the first line that states the XML version and encoding. Encoding is the way text characters are stored as bytes. The root element is the single outer tag that holds everything else.

Work on copies, and test one part first. If one part converts cleanly, the rest should follow the same pattern.

Trim Parts You Do Not Need

Some large files carry data you will never use. Old logs, long notes, or deep detail blocks can make up most of the size. If you trim those parts from a copy first, the file you convert will be much smaller. Remove whole elements, from opening tag to closing tag. Do not remove just one side of a pair.

You can also ask the source system to export less at a time, for example by date range. Three exports of one month each are easier to handle than one export of a full quarter.

Encoding and Research Files

XmlToCsv reads the file encoding from its BOM or declaration. A BOM is a small mark at the very start of a file that names its encoding. Encoding is the way text is stored as bytes. Supported encodings include UTF-8, UTF-16, ISO-8859-1, and windows-125x. If you split a file, save each part in the same encoding as the source, or text can turn into strange symbols.

Some of the largest files come from research and public data, and they fit streaming well because the records repeat in a clean pattern. If that is your case, you can work with research XML exports, which are often large using the same plan.

Common Mistakes and a Short Checklist

Common mistakes are easy to avoid. Do not try XLSX first for a large job. Do not skip the preview. Do not cut a file in the middle of a record. Do not close the tab mid-job, and do not work on the only copy of the source.

Before a large conversion, check: Is the file size within my plan limit? Did I pick CSV? Does the preview show the right columns, and does the total row count match what I expect? If the count is over 1,048,576, do I have a plan to split the result? Do I have a safe copy of the source? If the file is over 100 MB, have I split it at record boundaries or trimmed it first?

The Key Idea to Keep

Big files fail because many tools try to hold the whole file, plus several copies, in memory at once. Streaming fixes that root cause. Read a piece, write a row, let the piece go. Memory stays flat, time does the rest, and a file that once crashed every tool can finish as a clean CSV. Test with the preview, check the count, then let the full job run and work with the result in batches.

References

← All guides