PrivateCSV

Split a CSV file into multiple files

Cut a large CSV into smaller files by row count, header included.

CSV file

  • Nothing is uploaded
  • Free
  • No sign-up

Guide

Split CSV: the complete guide

Last updated 5 min read

About this tool

PrivateCSV is a free CSV splitter: it splits a large CSV file into smaller files, either with the number of rows you choose or up to a maximum size in MB, and copies the header row into every part. It counts real CSV records rather than text lines, so a quoted value that contains a line break is never cut in half, and it keeps the original delimiter. The file is processed by your browser, on your device.

How to check that your file is never uploaded

How to split a CSV file

  1. Choose the CSV file you want to split. Comma, semicolon, tab and pipe-separated files all work.
  2. Choose how to split: by number of rows (the header is not counted), or by file size, entering the largest size in MB that each file may have.
  3. Leave “First row is a header” ticked so the column names are copied into every file. Tick “Excel-compatible” if the parts will be opened in Excel.
  4. Click Split CSV. Each part is listed with its row count and size, ready to download.

Example

A three-row file split with 2 rows per file.

contacts.csv
id,name,city
1,Ana,Lisbon
2,Ben,Leeds
3,Chloé,Lyon
contacts-part-1.csv and contacts-part-2.csv
id,name,city
1,Ana,Lisbon
2,Ben,Leeds

id,name,city
3,Chloé,Lyon

When you need it

Getting under an import limit
Business apps cap the size of CSV imports. Salesforce's Data Import Wizard takes up to 50,000 records at a time, Shopify rejects product and customer CSV files over 15 MB, and HubSpot's free tools accept files up to 20 MB. Split by rows for a record limit, or by file size for a megabyte limit: enter 15 MB for Shopify and every part stays at or under it.
Opening a file that Excel or Google Sheets cannot load
An Excel worksheet holds 1,048,576 rows. Open a longer CSV and Excel warns that the file was not loaded completely, then drops the rest. Google Sheets stops at 10 million cells per spreadsheet, which is 500,000 rows for a 20-column file. Split below those numbers and open the parts one at a time.
Working in batches
Smaller files are easier to email (Gmail attachments stop at 25 MB), to check by hand, or to feed to a script or API that accepts a fixed number of records per call.

Why cutting a CSV by lines can break it

The obvious shortcut is to cut the file every N lines, in a text editor or with the Unix split -l command. That only works if no value contains a line break. Addresses, product descriptions and notes often do: RFC 4180, the CSV specification, allows a quoted value to span several lines. Cut through one of those and you get two broken files, and every part except the first has no header.

PrivateCSV parses the file, counts complete records and writes each part as valid CSV with the header on top.

What stays the same

Values are written back exactly as they were read, and nothing is converted: ZIP codes such as 02134 keep their leading zero and long IDs keep every digit. The original delimiter is kept, so a semicolon-separated export from a European version of Excel stays semicolon-separated. Fields are quoted only where needed (when they contain the delimiter, a double quote or a line break), and lines end with CRLF, as RFC 4180 recommends.

The parts are UTF-8. With “Excel-compatible” ticked, each part starts with a UTF-8 byte order mark (BOM), the signal Excel needs to display accented letters correctly when you double-click a CSV. It is off by default because some databases and scripts read the BOM as part of the first column name.

Limits to know about

  • Sizes use 1 MB = 1,000,000 bytes and include the header. A row is never cut in half, so a single row larger than the limit gets a part of its own, and the result warns you.
  • The parts are kept in your browser's memory until you leave the page. We test with a 400,000-row file; much larger files depend on the free memory of your device, and phones have less than computers.
  • Files are read as UTF-8. A file saved in an older encoding such as Windows-1252 can show � instead of accented letters; the CSV validator detects this.
  • Each part is a separate download. There is no ZIP download yet.

Frequently asked questions

Should I split by rows or by file size?

Follow the limit you need to respect. For a record limit, split by rows: 50,000 or fewer for Salesforce's Data Import Wizard, and under 1,048,576 rows including the header to open the parts in Excel. For a megabyte limit, such as Shopify's 15 MB, split by file size and enter the limit; each part is filled as close to it as possible without going over.

How do I split a CSV file into parts under 15 MB?

Choose “File size”, enter 15 and click Split CSV. Sizes count 1 MB as 1,000,000 bytes, slightly less than the 1,048,576 bytes some programs call a megabyte, so the parts fit either definition.

Is the header row repeated in every file?

Yes, as long as “First row is a header” is ticked. The number you enter counts data rows only, so with 1,000 rows per file each part holds the header plus 1,000 rows.

How do I open a CSV file that is too large for Excel?

An Excel sheet holds 1,048,576 rows, and when a longer CSV is opened, Excel shows only the first rows and warns that the file was not loaded completely. Split the file into parts below that limit, for example 1,000,000 rows each, and open the parts one at a time. To analyse all the rows at once instead, Excel's Data > From Text/CSV can load the file into the Data Model, which is not limited by the sheet size.

Can Excel split a CSV file into several files?

Not without a macro. Excel also loads only the first 1,048,576 rows of a CSV, so a file larger than that cannot even be opened completely before you start.

How do I split a CSV file with Python or the command line?

In Python, pandas.read_csv(path, chunksize=50000) reads the file in pieces that you can save with to_csv. On Linux and macOS, split -l is safe only when no quoted value contains a line break, and it does not repeat the header. This page does the same job without code.

Does splitting change my data?

No value is added, removed or reformatted. The only possible difference is quoting: fields are quoted when they need it, rather than copying the original file's quoting style. Any CSV reader sees the same values.

Related tools

Go further

Your files never leave your device

PrivateCSV runs every tool inside your browser. No upload, no account, nothing to install.