How-to

How to Split a Large CSV File

Break a CSV that's too big to open into smaller, workable files, by row count or by a column's value.

A CSV with millions of rows won't open cleanly in Excel (which caps near a million rows) and is awkward in most editors. Splitting it into smaller files makes it openable, faster to process, and easier to hand off in pieces.

There are two common ways to split: by size (every N rows becomes a new file) or by content (one file per value of a column, say one per region). Pick by-size when you just need smaller chunks, and by-content when each piece should be self-contained.

  1. 1

    Decide how to split

    By row count for even chunks, or by a column's value when each output file should hold one category. Keep the header row in every output file.

  2. 2

    Split by row count

    Use a command-line tool or script to write every N data rows to a new file. On macOS or Linux the split command does this; on Windows, PowerShell or a small script works.

  3. 3

    Split by column value

    Group rows by the chosen column and write each group to its own file. A filter plus copy-paste works for a few values; a script scales to many.

  4. 4

    Verify the row counts add up

    Sum the rows across the output files (minus repeated headers) and confirm they match the original. A mismatch means rows were dropped or duplicated.

Frequently asked questions

Why won't my big CSV open in Excel?

Excel supports about 1,048,576 rows. Beyond that it truncates silently. Splitting keeps each file under the limit.

Will splitting change my data?

It shouldn't, if you keep the header in each file and don't re-quote values. Verify row counts after splitting to be sure.

How do I keep the header in every split file?

Most split tools have an option to repeat the header; if not, prepend the header line to each output file as a final step.

Compare two spreadsheets

Drop two files into SheetCompare and see every changed cell. Free, private, and runs in your browser.