Split a CSV that is too big

The portal takes 5,000 rows at a time and your export holds 84,000. Here the file is cut into pieces, each one with the header row repeated on top, ready to upload one after the other. The file stays on your device.

Tap here or drag in the CSV to split

The most common sizes:
The most common sizes:
The file never leaves your browser: it is read here, one chunk at a time, and it is not uploaded anywhere.

Every piece opens with the columns already in place

The header row is copied on top of every piece, and that is not decoration: without it, the portal that receives the second file reads the first customer as if it were the column names, and that customer disappears. The same goes for Excel, for the back office system and for anyone receiving the pieces: a CSV with no header is a table nobody can read any more.

In front of the pieces go the three bytes known as the UTF-8 mark, the ones that make Excel open «città» instead of «città ». That is why the same file looks fine in a text editor and wrong in Excel, and it is the number one complaint of anyone splitting CSV files by hand. With one exception, and it is declared: if the file you started from is not written in UTF-8 (plenty of business systems still export in the old Windows encoding) that mark would state something false to Excel, so it is left out and the page tells you.

Put the pieces back together and you get the original file, byte for byte

This page rewrites nothing: it does not re-encode the text, does not touch the quotes, does not change the separator, does not tidy up the decimals. The file is walked byte by byte only to mark where each row ends, and the pieces are cut-outs of the original. The promise fits in one line, and it is the one the testing is built on: put the pieces back together, take off the UTF-8 mark and the repeated headers, and you get back exactly the file you started from.

That is also where the handling of quotes comes from. A field may contain the separator, doubled quotes and even a line break inside the field, which is the trap that breaks nearly every split done with a text editor: in there a line break does not end the row, and cutting at that point snaps the record in half. Here a row ends only where the record really ends. For the same reason a completely empty line stays where it is: dropping it would look tidier and would break the promise above.

By rows or by size: they are two different questions

«Five thousand rows at a time» is what a portal asks, counting records; «10 MB at most» is what a mailbox or an upload form asks, counting bytes. Counting rows is exact by definition. Counting size is exact too, and it is worth saying why: a piece here is the sum of three stretches of bytes, so its weight is known before it is written, not estimated; the piece is closed before the row that would bust it goes in, so every piece is as long as it can be. Before it reaches you the assembled file is weighed for real anyway, and if the weight does not match the count the page says so instead of handing you a file it cannot answer for.

Two things worth knowing about megabytes. Here 1 MB means one million bytes, the way websites and mailboxes count them: if whoever wants the file meant the 1,048,576 of Windows, your pieces still stay under. And an email attachment is rewritten in a form that makes it grow by about a third: with a mailbox that accepts 25 MB, the real file has to stay under 18-19. If you are preparing an email, aim there. Then there is the edge case: a row that on its own is over the limit cannot be cut in two, so it ends up in a piece of its own and gets flagged.

What this page does not do

It does not open Excel files. An .xlsx is a compressed archive, not a CSV, and the reader for those archives already lives on another page of this site: keeping two copies is the surest way to make them drift apart. If what you have is an .xlsx, the step is Excel (XLSX) to CSV.

It does not repair and it does not clean: if the file holds rows with a different number of columns, stray spaces or duplicates, those faults stay exactly as they are inside the pieces, because the pieces are the original cut up. The right place for that work is Clean up a CSV. If instead you need the opposite move, putting several CSV files back into one, there is Merge two CSV files. And if the pieces split here have to open in Excel without losing the zeros in front of the codes or turning postcodes into numbers, the step is CSV to Excel.