List prefix slicer
Slice text line by line: keep the first N characters of every line, or cut before the Nth delimiter with an option to keep the delimiter itself. Characters are counted as Unicode code points, unmatched lines are kept verbatim and counted separately, and everything runs locally.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
One entry per line. Blank lines are dropped and each line is trimmed by default; characters are counted as Unicode code points, so a Chinese character or an emoji counts as one.
1–500 code points; lines no longer than that are returned unchanged.
Sliced text
One line per entry, in the original order, ready to copy.
Enter text to see the sliced result
Lines: 0 · Sliced: 0 · Unchanged: 0 · Not matched: 0
What this tool does
- Pull the first column out of a pasted CSV or log block: turn "apple,red,10" into "apple" for every line at once.
- Cut a timestamp such as "2026-10-12 12:30" down to the date by slicing on a space, or take the second field by slicing on a comma.
- Trim long titles or notes to the first N characters before importing them into a spreadsheet or a message template.
Example
Input
apple,red,10 banana,yellow,20
Output
apple banana
The example slices by delimiter, using a comma and the first occurrence. Switch to "character position" to keep the first N characters of every line instead.
Frequently asked questions
How are Chinese characters and emoji counted?
By Unicode code point: one Chinese character counts as one, and so does an emoji. The split uses Array.from, so a surrogate pair is never cut in half. Skin-tone modifiers (the 🏽 in 👍🏽) and combining accents count as separate code points, so leave some margin for those.
What happens to a line without the delimiter?
It is kept exactly as it is, marked as unchanged in the line-by-line preview, and counted separately in the stats — nothing is dropped and no error is raised. In position mode, lines no longer than N behave the same way.
How are blank lines and surrounding whitespace handled?
Blank lines are dropped and each line is trimmed before slicing by default, so " abcdef " with N = 3 becomes "abc". Enable "Keep blank lines" to output empty lines verbatim and skip that trimming.
How does the occurrence counter work?
It starts at 1: 1 cuts before the first delimiter, 2 cuts before the second one (the result then contains the first delimiter and what follows it). Multi-character delimiters such as :: are matched as a whole, so a colon inside http:// is not mistaken for one.
Is my data uploaded?
No. Slicing runs as a pure function inside your browser — no network requests, no uploads, no analytics. Closing the page discards the input.
Keywords:text slicercut before delimiterslice list