📐 CSV Fundamentals · 6 min read
How Many Rows Can a CSV File Have?
A CSV file has no row limit in the format itself. RFC 4180, which registers the text/csv type, describes a file as a sequence of records and never names a maximum count. The ceilings people actually hit are set by the program reading the file: Excel stops at 1,048,576 rows, Google Sheets at 20 million cells, and a streaming parser keeps going until the disk runs out. We generated a 2,000,000-row CSV and streamed it back in 1.32 seconds with memory flat at 11 MB.
What that means in practice is that a file refusing to open is rarely broken. The limit lives on the other side of the open call, in the grid, the upload form, or your RAM, and the fix depends on which one is talking.
The format sets no row limit
RFC 4180 is short and, on this question, silent. It defines a record as a line, and a file as records separated by CRLF line breaks, but it never caps how many records a file can contain. The MIME registration in the same document lists exactly two optional parameters: charset and header. No row count, no size, no ceiling.
So when a tool tells you a file has too many rows, that tool is quoting its own limit. It is worth finding out which one before you start deleting data, because the row count is often not the real problem.
What we measured: a 2,000,000-row file
Rather than quote a number off a forum, we generated a CSV with 2,000,000 rows and five columns (id, name, email, city, amount) and read it back two ways, on a machine with 4 vCPUs and 16 GB of RAM, on 2026-11-14.
| How it was read | Rows counted | Time | Peak memory |
|---|---|---|---|
Streaming (csv.reader) | 2,000,000 | 1.32 s | 11 MB |
| Whole table in memory (pandas) | 2,000,000 | 8.10 s | 507 MB |
Two million rows came back in just over a second, with no error and no special handling. The file on disk was 116.6 MB, but the streaming reader never held more than 11 MB in memory at once, because each row is discarded before the next one is parsed. Only the full-table load ballooned, to 507 MB, which is a memory question rather than a row-count question.
Where the row limits actually sit
Once you stop expecting a limit in the file, the useful question is which reader is refusing you. These are the four that show up in most reports.
| Layer | Limit | What you see |
|---|---|---|
| CSV format (RFC 4180) | none stated | the file is fine |
| Excel worksheet grid | 1,048,576 rows | rows past the last one do not appear; the file still holds them |
| Google Sheets | 20,000,000 cells | import refuses or truncates instead of failing loudly |
| Streaming parser | your disk size | keeps going until storage runs out |
The 1,048,576-row and 16,384-column figures, and the 32,767-character cell ceiling, come from Microsoft's Excel specifications and limits page. Google's storage help pages list the 20 million cell cap for a spreadsheet. The streaming row sits at “your disk size” because RFC 4180 leaves it there.
Why Excel stops at 1,048,576
Excel's grid is a fixed, addressable space. Every worksheet has the same number of cells whether you use them or not, so a CSV can comfortably hold more rows than the grid has room to show. When that happens, Excel opens the first 1,048,576 rows and leaves the rest in the file, untouched. The data is not lost; it is just not on screen. That distinction matters, because the right fix is to split or re-read the file, not to recover anything.
How to work with a CSV that has more rows than Excel can show
- Count the rows first. You cannot fix a limit you have not located. A quick count tells you whether the problem is the grid or something earlier in the pipeline.
- Split by rows. Cutting the file into parts that each stay under 1,048,576 rows keeps the header on every part, and every part then opens normally. This is the fix that matches an Excel grid limit.
- Move it to a database. SQLite or a similar database has no spreadsheet grid, so it reads the whole file and lets you query the parts you need instead of opening it all at once.
- Read it streaming in code. A streaming parser keeps memory flat no matter how many rows arrive, which is what our 1.32-second, 11 MB read demonstrated.
With a file like that in hand, the CSV splitter cuts it into parts that stay inside the grid, and the CSV analyzer shows the header and the row count so you know what you are splitting. The column side of the same question is covered in how many columns a CSV can have, and the byte side in how big a CSV can get.
Frequently Asked Questions
How many rows can a CSV file have?
As many as your disk and the reading program allow. RFC 4180, which registers the text/csv type, defines a file as a sequence of records and never names a maximum count. Excel's worksheet grid shows at most 1,048,576 rows, and Google Sheets holds 20 million cells, but those are reader limits, not file limits. In our test a streaming parser read a 2,000,000-row CSV back in 1.32 seconds with memory flat at 11 MB.
Can a CSV have more than 1 million rows?
Yes. We generated a CSV with 2,000,000 rows and five columns, which was 116.6 MB on disk, and read every row back in 1.32 seconds with a streaming parser. The file itself was fine. What cannot hold 2 million rows is an Excel worksheet, whose grid is fixed at 1,048,576 rows, so the extra rows simply have nowhere to land when you open the file there.
What is Excel's row limit for a CSV?
1,048,576 rows, because that is the height of the worksheet grid, not a limit on the CSV. Microsoft's Excel specifications page states the grid is 1,048,576 rows by 16,384 columns and that a cell holds at most 32,767 characters. A CSV with more rows keeps all of them on disk; they only disappear when the grid has no room to show them.
Why does my CSV stop at 1,048,576 rows in Excel?
Because you have hit the edge of Excel's grid. The rows are still in the file, but a worksheet has no cells beyond row 1,048,576 to put them in. To work with the whole file, split it by rows before opening, or load it into a database or a streaming reader that does not lay the data out in a spreadsheet grid.
How many rows can Google Sheets handle from a CSV?
Google Sheets caps a spreadsheet at 20 million cells across all tabs, so the row ceiling depends on how many columns the file has. A 5-column CSV can hold about 4 million rows before the cell count runs out, while a 20-column file hits the ceiling at about 1 million rows. An import that would exceed the cap is refused or truncated rather than failing loudly.
What is the difference between a row limit and a file size limit?
A row limit is a count of records; a size limit is a count of bytes. The two trip up different things. Excel cares about rows, upload forms and APIs usually care about bytes, and Google Sheets cares about both through its cell and megabyte ceilings. A file can be under every size limit and still exceed a row limit, which is why splitting is the fix for one and compression is the fix for the other.
Split the File, Keep Every Row
If Excel will not open the file, the splitter cuts it into parts that keep the header and stay inside the grid, and the analyzer shows the row count before you split.
Related reading
CSV Fundamentals — other guides that pair well with this one.
- How to Open a CSV File on iPhone (Numbers, Columns and Encoding)
- What Is CSV File Format? (RFC 4180 Explained)
- CSV to Excel (XLSX): Convert Without Losing Leading Zeros or Dates
- Why Won't My CSV Open Correctly in Excel?
Browse all guides in the NoCodeCSV blog.