Splitting a text file into multiple files by line count is a line-oriented operation that reads the source top to bottom, divides the content into sequential groups of a fixed number of lines, and exports each group as its own UTF-8 text file. The output is a predictable set of numbered parts, each containing the same number of lines as the chunk size you entered, except for the final part, which holds any remainder. Every line of the source appears in exactly one of the outputs, so nothing is dropped and nothing is duplicated. The whole operation runs in your browser, which means the original file is read locally through the standard File API, decoded as UTF-8, sliced into groups, and downloaded directly to your machine — no upload step is involved. If the source uses CRLF line endings (Windows convention), standalone CR (older Mac), or LF (Unix and modern web), the splitter recognizes all three and counts CRLF as a single boundary. The output parts are always written with LF endings, which normalizes mixed input without changing the visible characters of any line. You retain control over the only two decisions that shape the result: the file you hand to the tool, and the whole-number chunk size you type in.

What line-based splitting actually does
Line-based splitting treats the source file as an ordered list of lines and slices that list at fixed intervals. The tool does not rebalance parts, does not split by byte size, does not split by word count, and does not try to detect paragraphs, chapters, or any higher-level structure. Every complete group contains the requested number of lines, except the last one, which simply holds whatever remains. Because the rule is purely positional, the same source file and the same chunk size always produce the same line counts, the same number of parts, and the same filenames — there is no randomness and no hidden state.
The character content of each line is preserved exactly as decoded: indentation, trailing spaces, punctuation, and Unicode text all pass through unchanged. The only thing the tool rewrites is the line-break character between lines, replacing mixed endings with LF so the output parts are consistent. This is the simplest contract a splitter can offer, and it is the one that matches the way most plain text, log, and Markdown files are written.
How to split a text file into multiple files by line count
- Open the Text File Splitter in your browser.
- Select one local file with a TXT, CSV, MD, or LOG extension that is no larger than 10 MiB.
- Type a whole number between 1 and 100,000 into the lines-per-part field.
- Run the split and check the displayed total line count and part count.
- Click each download button to save the numbered chunks to your machine.
Picking a chunk size that fits your goal
The chunk size is the only knob that changes the shape of the output. A small number of lines per part produces many small files; a large number produces few large files. The exact figures for your specific file come from the tool itself: after you run the split, it reports the total line count and the resulting number of parts. Use those two numbers to decide whether the chunk size you picked is producing a sensible number of outputs — for example, a 20,000-line file split into 200-line chunks produces 100 parts, while the same file split into 2,000-line chunks produces only 10 parts.
| Goal | Suggested chunk size | Why this range |
|---|---|---|
| Eyeball a small notes file | 100–500 lines | Keeps the part count low and each chunk easy to scroll |
| Share a large server log | 10,000–100,000 lines | Maximizes lines per file and minimizes the download count |
| Feed batches into a script | 1,000–10,000 lines | Balances the part count against the per-part size |
| Generate many small samples | 1–50 lines | Useful for inspecting data slice by slice |
For a concrete picture, consider a 250-line file with a chunk size of 100. Using the formula parts = floor(total lines ÷ chunk size) + 1 if a remainder exists, you get floor(250 ÷ 100) + 1 = 2 + 1 = 3 parts. The first part holds lines 1 through 100, the second holds lines 101 through 200, and the third holds lines 201 through 250 — two full parts of 100 lines and one final part of 50 lines. The same input and the same chunk size will always produce the same three parts with identical line counts, because a positional split is deterministic.
If your actual goal is exactly two equal halves, see this focused walkthrough for splitting a text file in half by lines.
Line endings, trailing newlines, and what stays intact
The splitter recognizes CRLF, standalone CR, and LF as line boundaries and counts CRLF as one boundary rather than two. Inside each output part, lines are joined with LF, so a file that mixes CRLF and LF in the original will come out consistent across all parts. This normalization affects only the invisible break characters between lines; it does not touch any visible character inside a line.
A trailing line boundary at the very end of the source counts as starting one extra logical line. Under the documented rule, a file that contains the single character "a" followed by LF is treated as having two logical lines, and splitting such a file with a chunk size of one produces a part containing "a" and a second part that is empty. This is intentional: it prevents the tool from silently discarding the trailing boundary, which would change the line count and could surprise users who compare line totals before and after.
Empty files are rejected because there are no lines to partition — the operation cannot produce meaningful parts when there is no content to distribute.
Filenames, downloads, and managing many output parts
The output parts use a deterministic naming pattern. The original base filename is preserved, and each chunk is suffixed with the literal string "-part-" followed by a three-digit zero-padded sequence and the .txt extension. A file named notes.txt with 250 lines and a chunk size of 100 produces notes-part-001.txt, notes-part-002.txt, and notes-part-003.txt. The .txt extension is always used on the outputs regardless of whether the source was .csv, .md, or .log — the chunks are plain UTF-8 text, so an original .csv extension is not preserved as a claim that each chunk remains a valid CSV on its own.
Each download is triggered by clicking the individual download button for that part. The tool creates a temporary object URL at click time, starts one download, and revokes the URL immediately, so no long-lived blob is kept around in the page. If you change the source file or the chunk size, the previous result is cleared so the filenames and counts from the old configuration cannot be mistaken for the new one.
Because the parts are downloaded one at a time, the browser may ask for permission to save multiple files when the part count is high. This is normal browser behavior, not a tool limitation, and accepting the prompt lets every chunk arrive in the destination folder. No ZIP archive is created, because doing so would require introducing a packaging dependency that is otherwise unnecessary.
When line-based splitting is the wrong tool
A positional line split is the right choice for files where each line is an independent unit — plain notes, server logs, subtitle-like rows, simple list exports, and short Markdown fragments. It is the wrong choice for formats where a single record can legally span more than one line.
| File type | Line-based split safe? | Reason |
|---|---|---|
| Plain TXT notes | Yes | Each line stands alone |
| Server logs (one event per line) | Yes | Boundaries are stable and predictable |
| Markdown prose with short sections | Usually | Most sections fit inside a single chunk size |
| CSV with quoted multi-line fields | No | A quoted field can legally contain a newline, and splitting at that boundary breaks the record |
| JSON or XML documents | No | Objects and elements routinely span many lines |
| Source code files | Depends | Functions and classes can span many lines; splitting at a fixed interval may cut a function in two |
If structural validity matters — for CSV exports, JSON, XML, or programming source — use a format-aware parser that understands the record or token boundaries and only cuts between them. The MDN documentation for the Blob and File.text APIs explains how browsers decode file bytes locally, which is the basis for keeping every operation on your machine: Blob and File.text.
Finally, treat the original file as the source of truth. Keep it on disk until every required chunk has been downloaded and verified, because the operation never modifies the source — it only reads from it. The same decoded input and the same chunk size will always produce the same strings, the same line total, the same part count, and the same zero-padded filenames, with no server storage, no account, and no retained processing history.
If you're weighing options, Add Line Numbers to Text, Explained End to End covers this in detail.