← All tools
// TEXT

Line Range Extractor online

Extract a range of lines from text by specifying start and end line numbers.

Line Range Extractor logo
by
CHUNKY
MUNSTER
From line: To line:
TEXT INPUT0 LINES
EXTRACTED LINES0 LINES

About Line Range Extractor

Extract any specific section from a multi-line document by providing start and end line numbers (1-indexed). Useful for picking sections from logs, code files, or data exports. Runs entirely in your browser.

How to Use the Line Range Extractor

  1. Paste or enter your input into the text field.
  2. Configure any options (format, delimiter, encoding, or mode) using the controls above the output.
  3. The result updates instantly — no submit button required for most operations.
  4. Click Copy or Download to take the output to your next step.

Paste your text, type the start and end line numbers, and the tool returns just that slice. Numbering is 1-indexed and the range is inclusive on both ends — entering 1 to 10 returns ten lines, the same convention used by sed -n '1,10p' and by most editor 'go to line' boxes.

How the Line Range Extractor Works

If the end line is past the end of the input, the tool returns everything from start to EOF rather than throwing an error. If start is greater than end, the values are swapped automatically. The summary row shows the total line count of your input so you can quickly choose a sensible range.

Frequently Asked Questions

Are line numbers 0-indexed or 1-indexed?

1-indexed — line 1 is the first line, matching the convention of every editor's 'go to line' box and sed.

What happens if the end line is past the last line?

You get everything from the start line to the end of the input. No error — the tool clamps the range to what exists.

Is the range inclusive of both ends?

Yes — selecting 5 to 10 returns six lines (5, 6, 7, 8, 9, 10).

Can I extract non-contiguous ranges, like lines 1-5 and 20-25?

Not in one pass — run the tool twice and concatenate the results. A multi-range mode is on the wish list.

Explore the full suite of TEXT tools and 290+ other free utilities at Chunky Munster.