RunLocalTools

CSV splitter

Split a big CSV or Excel file into many — by row count, size, a column’s values, dates, number ranges, a condition or a random train/test split. Quoted fields, commas and line breaks inside cells are handled correctly. Nothing leaves your browser.

What it does

Drop in a CSV, TSV or Excel file and this tool cuts it into several smaller files, using the rule you choose. You can split it every N rows, into N equal files, or into pieces that stay under a size limit — handy for email attachments and upload caps. You can also split by what’s in the data: one file per value in a column, per month or year in a date column, per number range, or by whether each row matches a condition. For machine-learning work there’s a seeded random split into train, test and validation sets.

Before anything is written you see a plan: every file that will be created, how many rows it will hold and roughly how big it will be, with a check that the rows going in match the rows coming out. Then you download the pieces as a single zip, or one by one.

How it works

A proper CSV parser, not a line splitter

Most quick splitters cut a file at line breaks, which tears apart any row whose cells contain a line break or a comma inside quotes — an address field, a free-text note. This tool reads the file the way a spreadsheet does: quoted cells, escaped quotes ("") and line breaks inside cells are kept together, so a row is never cut in half. When you don’t change the delimiter or the columns, each row is copied through exactly as it appeared in the original, byte for byte.

Read in pieces, so big files don’t freeze the page

The file is read in 4 MB slices rather than loaded into one giant string, and a progress bar shows how far along it is. The delimiter (comma, semicolon, tab or pipe) and the text encoding are detected for you — a Windows-1252 file from an older system is converted so accents come out correctly in the UTF-8 output — and you can override either one.

The nine ways to split

  • Every N rows and into N equal files — the plain options.
  • By maximum file size — files are cut on row boundaries, never mid-row, and the repeated header counts towards the limit.
  • By a column’s value — one file per distinct value, with options to ignore case and surrounding spaces, to fold rare values into an “other” file, and a guard that stops you from accidentally creating thousands of files.
  • By date — one file per year, quarter, month, ISO week or day, reading dates written year-first, day-first or month-first.
  • By number ranges — you give the cut-points (say 0, 100, 1000) and each range gets its own file.
  • By a condition — build rules such as “city equals Paris” or “amount is greater than 100”, combine them with AND or OR, and get a matching file and a not-matching file, or only one of them.
  • Random split — percentages like 80, 10, 10 with optional names. Group sizes are exact, and the same seed always produces the same split, so you can reproduce it later.
  • Round-robin — row 1 to file 1, row 2 to file 2, and so on round and round.

Options on the way out

Repeat the header row in every file (or not), change the delimiter, choose LF or CRLF line endings, add a UTF-8 byte-order mark so Excel reads accents correctly, quote every cell, trim stray spaces, keep only the columns you tick, or write Excel (.xlsx) files instead of CSV. File names come from a template using {name}, {n}, {label}, {start}, {end} and {rows}, and clashes or characters that aren’t allowed in file names are fixed for you.

How to use it

  1. Add your file. Click or drop one or more .csv, .tsv, .txt, .xlsx or .xls files. If the file has several worksheets, pick the one you want. Check the delimiter, encoding and “first row is a header” settings against the preview. If the file needs tidying first — stray spaces, duplicates, odd blanks — run it through the CSV cleaner and bring it back.
  2. Pick how to split and fill in the setting that appears: rows per file, the column to split on, the cut-points, your rules and so on.
  3. Read the plan. It lists every file with its row count and size. Anything odd — a date format that couldn’t be read, rows wider or narrower than the header, a size limit smaller than one row — is flagged in plain language.
  4. Set the output options in the panel on the right: format, delimiter, line endings, columns to keep, and the file-name template.
  5. Press Create files, then download everything as one zip (with an optional manifest listing each file and the row check) or one file at a time. You can also preview a piece and send it straight to another tool. And when you need to put pieces back together, Merge CSVs does the opposite job.

Supported formats

Input: CSV, TSV and delimited text (comma, semicolon, tab or pipe), in UTF-8, UTF-16, Windows-1252 and other common encodings, plus Excel .xlsx and .xls workbooks. For Excel input, cell values come through as Excel displays them, from the worksheet you choose; to look through a workbook before you split it, open it in the XLSX viewer.

Output: CSV (or TSV when you choose a tab delimiter) in UTF-8, or Excel .xlsx.

Frequently asked questions

How do I split a large CSV into smaller files?

Add the file, choose Every N rows, Into N equal files or By maximum file size, and press Create files. If you’re splitting to get under an email or upload limit, use the size option: it keeps every file under your limit without ever cutting a row in half, and repeats the header in each piece.

Will it break rows that have commas or line breaks inside quotes?

No. Cells wrapped in quotes are read as a unit, so a comma or a line break inside a quoted cell stays inside that cell and the row stays in one piece. If a file ends inside an unclosed quote, the splitter tells you and keeps the last row as it is rather than guessing.

How do I split a CSV by country, month or another column?

Choose By a column’s value and pick the column — you get one file per distinct value, named after it. For dates choose By date, then pick year, quarter, month, ISO week or day and tell it how your dates are written (2024-03-07, 07/03/2024 or 03/07/2024). Rows with a date it can’t read are collected in their own file and flagged, so nothing goes missing. If the files will be shared outside your team, strip the personal data first with the CSV Anonymizer.

Can I make a reproducible train/test split?

Yes. Choose Random split, enter the percentages (for example 80, 10, 10), name the groups if you like, and set a seed. Group sizes are exact, every row lands in exactly one group, and the same seed on the same file always gives the same split. Write the seed down and you can recreate it later.

How big a file can it handle?

The file is processed in slices, so a file of tens of megabytes is fine — in our testing, a 60 MB file with a million rows was scanned and split in a matter of seconds. The real limit is your browser’s memory, which depends on your device, and the single-zip download holds the finished files in memory, so for very large results use Download one by one. A single run creates at most 5,000 files, and Excel output is limited to Excel’s own 1,048,575 rows per file.

Why do accented characters look wrong when I open the result in Excel?

Excel often assumes an older text encoding unless the file starts with a byte-order mark. Tick Add a UTF-8 BOM in the output options and Excel will read accents correctly. The splitter always writes UTF-8, and converts older encodings such as Windows-1252 as it goes.

Privacy

Splitting happens entirely in your browser: your file is read on your device and the pieces are built on your device. Nothing is uploaded, and the tool never sends your data anywhere.

Two features load a small open-source helper library from a CDN the first time you use them: reading or writing Excel files, and downloading a .zip. Loading a library sends none of your data, and after the first time it works offline. Splitting a CSV and downloading the files one by one needs no outside request at all.

So that your work survives a refresh, files you add are kept in your browser’s own storage (up to 100 MB each; larger files work for the visit but aren’t kept) along with your settings. They never leave your device. The Clear saved files & reset button removes them, and so does clearing your browser’s site data.

Limitations

  • Splitting by file size needs CSV output, because Excel files are compressed and their size can’t be predicted.
  • For Excel input only the chosen worksheet is split, and formulas arrive as their calculated values.
  • Rows with a different number of columns from the header are split like any other row and kept as they are; they are flagged in the file details.
  • The regular-expression condition refuses patterns known to cause runaway slowdowns, rather than risk freezing your browser tab.
  • Hand-off to other tools is limited to 100,000 rows; for larger pieces, download the file instead.