Skip to content
UniKit

Line range slicer

Slice text by line numbers: pick a start and end line (negative values count from the end), sample every Nth line, and see the totals — all in your browser.

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

Text

Line-based: \r\n, \r and \n all count as line breaks, a single trailing newline is not an extra line, and empty lines are preserved.

Counts from 1; negative values count from the end, so -1 is the last line.

Inclusive; leave empty for the last line. Negative values also count from the end.

A step of 2 keeps every other line — handy for sampling a long file.

Sliced lines

Lines are joined with newline characters; copy them or download a TXT file.

Paste text to slice it

What this tool does

  • Pull just the lines you need (say lines 100–150) out of a log or data file and paste them elsewhere
  • Sample a long document by setting the start line to 1 and the step to 10
  • Use negative line numbers to keep the tail of a file — start at -3 and leave the end empty for the last three lines

Example

Input

Line 1
Line 2
Line 3
Line 4
Line 5

Output

Line 2
Line 3
Line 4

Start line 2, end line 4, step 1: 5 lines in total, effective range 2–4, three lines kept.

Frequently asked questions

How are line numbers counted, and what do negative values mean?

Counting starts at 1 and the end line is inclusive, so lines 2 to 4 returns three lines. Negative values count from the end: -1 is the last line and -3 is the third from last. Out-of-range values are clamped to the first or last line instead of failing; only an end line before the start line is rejected.

How are line breaks and empty lines handled?

\r\n (Windows), \r (classic Mac) and \n (Unix) all count as line breaks, and a single trailing newline does not create an extra line, so "a\nb\n" is two lines rather than three. Empty lines in the middle are preserved and count as lines.

What is the step for, and does it lose content?

A step of N keeps one line out of every N inside the range — with range 1–5 and step 2 you get lines 1, 3 and 5. It is a sampling aid: the result reports how many lines were skipped by the step and your original text is never modified.

Is my text uploaded, and how large can it be?

Nothing is uploaded; everything runs in browser memory. The practical limit is available memory — files with tens of thousands of lines are fine. Convert screenshots or Word documents to plain text before pasting.

Keywords:line range slicerslice linesoffline

Related tools