- Home
- Split a Text File Online
Split a Text File Online
Split a text file online by line count, equal parts, or target size and download the results, all in your browser with no file uploads.
How to split a text file online
Split a text file online when a log, list, or export is easier to handle in smaller pieces. This free TXT file splitter processes the selected file in your browser without uploading its contents. Choose a line count, number of parts, or target file size, optionally repeat the first line as a header, and download the generated parts. The original stays on your device unchanged. No account is required, and you can inspect the part sizes before deciding which downloads to keep.
- Select a text file up to 50 MiB. Use a small representative file first if you are checking a new workflow.
- Choose lines, equal parts, or target size. Enter the data-line quota, number of parts, or size target.
- Decide whether the first line should repeat as a header. Choose the output encoding, line endings, and base filename.
- Generate the parts, review their names and sizes, and download individual TXT files or all parts in a ZIP archive.
The splitter produces at most 1,000 parts. Combined output is also capped at 128 MiB to limit expansion from repeated headers; if you reach that limit, reduce the header size or the number of parts. If your settings would create more, request fewer parts or increase the line count or target size. Each part receives a sequential suffix padded to at least three digits, such as records-part-001.txt, so ordinary filename sorting keeps the early parts in order. Preserve those numbers if another person or process will assemble the pieces later.
Split by a fixed number of lines
Line mode groups physical text lines in source order. For example, choosing 1,000 data lines per part puts the first 1,000 lines in the first part, the next 1,000 in the second, and any remainder in the last. The final part can therefore be shorter. Screen wrapping does not add physical lines: a long paragraph that wraps in an editor may still count as a single line in the file.
Blank lines are meaningful lines and remain part of the sequence. If every record occupies one line, this mode is a useful way to make evenly sized batches for manual review or an importer. It does not understand application records that span several physical lines. A CSV field with an embedded quoted newline, a multiline error message, or a paragraph separated by blank lines can cross a part boundary. Choose boundaries with the downstream format in mind.
Repeating a header treats the first physical line as the header and places it at the start of every part. That repeated line does not count against the data-line quota. A setting of 1,000 data lines can therefore produce a part with 1,001 physical lines when a header is included. Use this for a simple column-name row; it does not discover a multi-line header or infer a schema from the document.
Split into a chosen number of equal parts
Choose the number-of-parts mode when you know how many batches you need. It distributes data lines as evenly as possible, with earlier parts receiving an extra line when needed. Ten data lines split into three parts become groups of four, three, and three. This balances line counts, not byte sizes. If you request more parts than there are data lines, fewer parts are generated instead of empty extras. With header repetition enabled, the first line is excluded from that distribution and prepended to every part.
Split by target file size
Size mode builds parts from complete lines while working toward the selected size. The target applies to encoded output bytes rather than the number of visible characters. Newline style, non-ASCII characters, and output encoding all affect the result. A part containing Chinese text may use more UTF-8 bytes than another part with the same character count in basic English. Review the generated sizes when another system imposes a limit.
Repeated headers and any output BOM count toward each part's target size. The splitter keeps an individual line intact, so a line that is larger than the target can create an oversized part. Treat the setting as a target for line-preserving output, rather than a guarantee that every download is below an absolute byte ceiling. If a receiving system has a strict limit, inspect all part sizes and handle an exceptionally long line separately.
Keep the right encoding and line endings
Supported inputs include UTF-8, UTF-8 with a BOM, and UTF-16 text with a BOM. ASCII-only content is also valid UTF-8 and may be detected that way. Legacy encodings such as Windows-1252, GBK, and Shift-JIS are not supported. If a file uses one of those encodings, first save a Unicode copy with an editor that can decode the original correctly. Changing its extension will not convert the content.
Keeping source settings uses the detected encoding and line-ending style as output defaults. UTF-16 BE input is saved as UTF-8 when keeping the encoding because UTF-16 BE is not an output option. Choosing an explicit encoding or LF/CRLF rewrites the parts consistently; it does not promise that concatenating them later reproduces every original byte. The CRLF and LF guide and sample TXT downloads help you test these differences.
Split a text file on Windows
On Windows, PowerShell 7 can stream a UTF-8 file into 1,000-line batches:
Get-Content -LiteralPath input.txt -Encoding utf8 -ReadCount 1000 |
ForEach-Object -Begin { $part = 0 } -Process {
$part++
$_ | Set-Content -LiteralPath ('part-{0:D3}.txt' -f $part) -Encoding utf8NoBOM
}
Get-Content's ReadCount option sends batches through the pipeline; ForEach-Object initializes the counter once in Begin and processes each batch. This assumes UTF-8 input, rewrites UTF-8 without BOM using system newlines, and adds no repeated header. The final part can be shorter. Use a folder without existing part files.
Split a text file on macOS or Linux
Terminal offers local alternatives for larger or scripted jobs. These examples use a prefix for the output filenames:
split -l 1000 input.txt part-
split -b 1048576 input.txt chunk-
The first splits by 1,000 lines; the second uses 1,048,576-byte chunks. The GNU split documentation defines -l for lines and -b for bytes. These short options are also available in the macOS split utility; consult man split for your installed version. Filename suffix defaults and additional options can differ between systems.
Byte mode can cut a line or a multibyte character, so an individual chunk may be unreadable until the original bytes are reassembled in order. These commands also do not automatically repeat your header row. Run them in a separate output directory when you want to keep the source and resulting parts easy to identify. The browser tool is useful for choosing readable, complete-line parts with a visible list of outputs.
Use smaller parts and check the result
Check part boundaries, repeated headers, and the final record after splitting. Contents stay in your browser, while processing needs device memory. Use the text file merger to rejoin parts, accounting for headers and separators. For delimited spreadsheet data, consider the TXT to CSV converter.
Text file splitter questions
Yes. Choose line mode and enter the number of data lines per part. Blank lines count, and the final part may contain fewer lines. A repeated header is excluded from the data-line quota.
Not always. Size mode keeps whole lines together, so a single line larger than the target can produce an oversized part. Repeated headers and any output BOM count toward the encoded size.
Yes. Enable the repeat-header option to copy the first physical line to every part. It supports a single-line header and does not detect multiline headers automatically.
The input file can be up to 50 MiB, and a run can produce at most 1,000 parts with 128 MiB combined output. Request fewer parts, increase the line count or size target, or disable repeated headers if a limit is reached.
No. The selected file is read and split in your browser, and the generated downloads stay on your device. No account is required.
You can join the parts in order with the text file merger. Remove repeated headers and choose separators carefully. Encoding and newline changes mean the result may not be byte-for-byte identical to the original.