How to split a large CSV file into multiple files

To split a large CSV file, decide how big each part may be, then cut it into pieces of that many rows and repeat the header row at the top of every piece. The splitter on this page does exactly that in your browser: choose rows per file, a number of equal files or one file per value of a column, and download all parts as a ZIP.

6 min read

The short answer

A CSV file is plain text with one record per line, so splitting it sounds as simple as cutting the text every few thousand lines. Two details make that unreliable: the header row exists only once at the top, so every part after the first would have no column names, and a value in quotes may contain line breaks, so a blind cut can split one record in half. A proper CSV splitter reads the file record by record, copies the header into each part and only cuts between complete records.

With the tool below, drop the CSV on the page, keep Split by on Row count, enter the number of rows per file and wait a moment. Each part appears in the list with its own download button, and Download all as ZIP saves them together. Nothing is uploaded: the file is read in your browser, which also keeps customer and order data private.

Try it here: Split CSV

Open the full tool page

Why you would split a CSV

Most splits are forced by a limit somewhere else. Import screens in online stores, marketplaces, email marketing tools and CRMs often accept only a certain number of rows or megabytes per upload. Excel shows at most 1,048,576 rows per sheet and becomes slow long before that, and Google Sheets has a cell limit for the whole spreadsheet. Email attachments are usually capped at 20 to 25 MB.

Other splits are about people rather than software: one file per region for regional managers, one per supplier with only their products, or equal shares of a call list for each member of a team. Those cases call for splitting by the value of a column or into a fixed number of files instead of a fixed row count.

SituationSplit byTypical setting
Import limit of 10,000 rows per fileRow countRows per file: 10000
File too big for ExcelRow countRows per file: 1000000
Same share for four colleaguesNumber of filesNumber of files: 4
One file per branch, city or supplierColumn valueColumn: Branch
Attachment over the email size limitNumber of filesEnough files to stay under the limit

Choosing the right size for each part

If a platform states a row limit, use it directly but leave a little room, because some importers count the header as a row. For a limit given in megabytes, divide the file size by the limit and round up to get the number of files, then pick Number of files so each part is about the same size. A 180 MB export with a 50 MB limit needs four files.

Rows per file and Number of files behave differently with the last part. Rows per file fills every part completely and leaves the remainder in the last one, so 25,500 rows at 10,000 per file give two full files and one with 5,500 rows. Number of files divides the rows as evenly as possible, so the same table in three files gives 8,500 rows each.

Parts are named after the original file with a number that has the same width for every part, such as orders_01.csv to orders_12.csv, so they stay in the right order when sorted by name.

Splitting by the value of a column

Choose Column value under Split by and pick the column from the list, which is filled from the header of your file. The tool creates one file for every distinct value and names it after that value, for example orders_Leeds.csv and orders_York.csv. Rows in which the column is empty are collected in a file with empty in its name, so no row is lost.

Values are compared after removing spaces at the start and end, so York and York with a trailing space end up in the same file. Upper and lower case are kept apart, because in codes they can mean different things. A column with more than 1,000 different values, such as an order number, would create far too many files, so the tool stops and asks for a column with fewer values.

Keeping the data intact

The separator is detected automatically, whether the file uses commas, semicolons, tabs or vertical bars, and the parts keep the same separator unless you choose another one under Separator. Quoted values that contain commas, quotes or line breaks stay in one cell. Values are copied exactly, so barcodes and postal codes with leading zeros, long ID numbers and dates are not changed.

Each CSV part is saved as UTF-8 with a byte order mark, which tells Excel to show accented letters correctly when the file is opened with a double click. If the original was saved by an old program in a regional Windows encoding, it is recognized and converted to UTF-8 on the way. You can also set Save as to Excel to get .xlsx workbooks with a bold, frozen header row, where columns with leading zeros stay text.

Very large files and other methods

The tool reads CSV files in small pieces in a background worker, so a 100 MB file with several hundred thousand rows is split in seconds on a normal laptop and the page keeps responding. The limit is the memory of your device: the parts are kept in memory until you download them, so for files of several gigabytes a command line tool is the better choice.

On macOS and Linux the split command can cut a file by lines, for example split -l 10000 data.csv part_, but it does not repeat the header and it cuts inside quoted values that span several lines. In Excel you can copy blocks of rows into new workbooks by hand, which works for a few parts but is slow and easy to get wrong. Power Query or a short Python script with the csv module handle quoted line breaks correctly, if you are comfortable with them.

Common problems and fixes

  • The parts have only one column: the file uses a separator Excel does not expect. Import it with Data, From Text/CSV, or set Save as to Excel.
  • A message says a quoted value is not closed: a quote character is missing somewhere in the file, often in a product description. Open the file in a text editor, find the line and fix the quote.
  • The column list is empty: add the file first; the list is filled from its first row. If the file has no header, turn off First row is header and choose the column by number.
  • Too many files: with a small Rows per file value a large table would produce thousands of files. Choose a bigger value; the tool allows up to 1,000 parts.

Step by step

  1. Add the CSVDrop the file on the tool or press Choose files. Several files can be split at once with the same settings.
  2. Choose how to splitPick Row count, Number of files or Column value under Split by and enter the number or choose the column.
  3. Check the header optionKeep First row is header turned on so the column names are repeated at the top of every part.
  4. Download the partsDownload single parts from the list or press Download all as ZIP to save every part at once.

Frequently asked questions

How do I split a CSV file into multiple files with headers?

Use a splitter that copies the header row into every part, such as the tool on this page with First row is header turned on. Simple line based tools only keep the header in the first file.

How many rows can a CSV file have?

CSV itself has no limit. The limits come from the programs that open it, such as Excel with 1,048,576 rows per sheet or an import screen with its own maximum.

Can I split a CSV file without Excel?

Yes. The splitter here runs in any modern browser on Windows, Mac, Linux or a phone, and does not need Excel or any installed program.

Is my CSV uploaded when I split it here?

No. The file is read and split in your browser, and the parts are created on your device. Nothing is sent to a server.

Will splitting change my numbers or leading zeros?

No. CSV parts contain the values exactly as they were. Only if you save as Excel are numbers stored as numbers, and columns with leading zeros still stay text.

Can I join the parts again later?

Yes. Open the Merge CSV files page of the same tool, add the parts in order and press Merge files. The header is written once and the rows follow in the order of the list.