Line range extractor

Paste a long text, type the first and last line number and get just those lines. Add a step to take every 2nd or 5th line, or invert the choice to delete the range and keep the rest.

Lines in the result: 5 of 8

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Paste your text.
  2. Enter the first line number in “From line” and the last in “To line” (empty means the end).
  3. Set “Every” above 1 to keep only every k-th line of that range.
  4. Tick “Remove these lines instead” to delete the range and keep everything else.

How it works

Every line gets a number from 1. A line is chosen when its number is at least the first one, at most the last one (if given), and its distance from the first is a multiple of the step. The chosen lines are joined with line breaks.

Worked example

With the 8 sample lines, From 2 to 6 gives “Line two” to “Line six”, 5 lines. From 1, to the end, every 3, gives lines 1, 4 and 7. Removing lines 2 to 6 leaves lines 1, 7 and 8.

Tips

Use it to cut a header from a data file (From 2), take a sample of every 10th row, or pull one page out of a long list.

Frequently asked questions

How are lines numbered?

The first line is line 1. A blank line counts like any other, and a line break at the very end of the text does not add an extra empty line.

What does the Every field do?

It takes every k-th line of the range, starting with its first line. From 1 to the end, every 3, gives lines 1, 4, 7 and so on. Every 1 gives all lines in the range.

What if To line is empty?

Then the range runs to the last line of the text.

How do I get only the even lines?

Set From line to 2, leave To line empty and set Every to 2. For odd lines, start from 1.

More in Text

All tools in this category: Text ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.