Skip to content
UniKit

Split text file by content

Cut a text file into several parts by content: split on a marker, on lines matching a regex, or by a per-segment line or UTF-8 byte limit, then preview each part and download it individually or as one ZIP, all locally.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Text content

Only the text content is read and nothing is uploaded; the result is shown per segment and can be downloaded one by one or as a ZIP.

The file is read locally with FileReader, up to 50 MB; split bigger files locally first.

Segments

Every segment ends with a newline; the combined view concatenates the segments with a file name header so you can copy everything at once.

Enter text or choose a file to cut it

What this tool does

  • Cut a large TXT with separator lines (logs, manuscript chapters, exports) into several smaller files
  • Split long text by a line or byte limit so it can be imported in batches into systems with size limits

Example

Input

----- 第一节
春天来了。
----- 第二节
夏天来了。

Output

===== part-01.txt · 1 lines · 16 bytes =====
春天来了。

===== part-02.txt · 1 lines · 16 bytes =====
夏天来了。

Mode = split on a marker with the marker -----: the matching line is dropped entirely and starts a new segment, giving two segments of one line each (every segment ends with a newline, hence 16 bytes).

Frequently asked questions

Can it split the file in place on disk?

No. For security reasons a browser cannot rewrite a file on your disk and cannot trigger several downloads at once, so this tool only cuts the text in memory: download the segments one by one, or use "Download all as ZIP" to grab all of them at once (the ZIP is built in the browser with fflate and never touches a server).

How do the four modes differ?

1) Split on a marker: a line starting with the marker (leading spaces ignored) begins a new segment, which suits separator lines such as ----- or [section]; 2) split on lines matching a regex, for example ^Chapter, where the matching line becomes the first line of a new segment; 3) split by a line limit: N lines per segment; 4) split by a byte limit: a new segment starts before the byte budget is exceeded, counted as line bytes + 1 newline so the output size is predictable. The first two find cut points by content, the last two divide by size.

Is the separator line kept?

It is dropped by default (the whole line). Enable "keep the marker line in the segment" to make the marker line the first line of the new segment. Note that the whole line is dropped, not just the marker text — if your separator lines carry a title such as ----- Chapter 2, enable the option to keep that title.

Are there size or line-ending limits?

Picking a file reads it locally with FileReader in one pass, limited to 50 MB (larger files should be split locally first) because the comparison happens in memory. Line endings are normalised to LF on output and every segment ends with a newline, so CRLF files come back with LF and the last line always has a trailing newline.

Keywords:split text filetxt splittertxt-content-incise

Related tools