Extract a sublist by range

Paste one item per line and extract items between `From` (inclusive) and `To` (exclusive) using zero-based indices. Optional Every-Nth stride applies after the slice. Same op as Extract a list fragment and Slice a list - three URLs for different search intents.

Input
Ready
Output
Live

Zero-based slice with optional stride

The op is `Array.slice(from, to)` on your non-empty lines. `From` includes the item at that index; `To` excludes it. Defaults are `From = 2, To = 6` - with a 7-item sample that gives you indices 2, 3, 4, 5 (Item3 through Item6).

Leave `To` blank to slice to the end of the list. Negative indices count from the end: `From = -3` is "third-from-last", `To = -1` excludes the last item.

Every-Nth applies after the slice as an index filter - `2` keeps every other item from the sliced range, `3` keeps every third. Default `1` keeps all items. Out-of-bound ranges return empty output with no error.

How to use extract a sublist by range

  1. 1Paste one item per line into the input panel
  2. 2Set `From` (zero-based, inclusive) - default `2`
  3. 3Set `To` (zero-based, exclusive) - default `6`, blank = end
  4. 4Optionally set Every-Nth stride (default `1` = every item)
  5. 5Output updates live; out-of-bound or invalid ranges return empty

Keyboard shortcuts

Drive ListShift without touching the mouse.

Shortcut Action
Ctrl ZUndo last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor
EscExit fullscreen
Ctrl KOpen the command palette to jump to any tool
Ctrl SSave current pipeline draft Plus
Ctrl PRun a saved pipeline Plus

What this tool actually does

Array.slice semantics with an Every-Nth post-filter.

Zero-based, From inclusive, To exclusive

`From = 2, To = 6` gives four items at indices 2, 3, 4, 5. Matches JavaScript `Array.slice` and Python `list[from:to]`. If you think 1-based, subtract one everywhere.

Negative indices count from the end

`From = -3, To = blank` returns the last three items. `To = -1` excludes the last item. Use negative indices for tail-relative slices without knowing the list length.

Blank To means end

An empty `To` field (or unset) slices from `From` through the last item. Useful for "everything from index N onwards" without knowing the count.

Every-Nth applies after slicing

The slice runs first, then the stride filter keeps every Nth item of the slice output. The stride is relative to the slice, not the original list.

Same op as sibling slice tools

Extract a list fragment, Slice a list, and this page all use the same underlying `slice_range` op with the same defaults. Three URLs, one tool.

Worked example

Defaults `From = 2, To = 6, step = 1`. Slice returns indices 2..5 → Item3, Item4, Item5, Item6.

Input
Item1
Item2
Item3
Item4
Item5
Item6
Item7
Output
Item3
Item4
Item5
Item6

Settings reference

How each option shapes the output using the sample above.

Setting What it does Effect on the sample
`From: 2, To: 6` (defaults) Indices 2..5 inclusive `Item3`, `Item4`, `Item5`, `Item6`
`From: 0, To: 3` First three items `Item1`, `Item2`, `Item3`
`From: -2, To: blank` Last two items `Item6`, `Item7`
`From: 0, To: blank, Every-Nth: 2` Every other item from the whole list `Item1`, `Item3`, `Item5`, `Item7`
`From: 5, To: 2` (From > To) Invalid range - empty output (empty)

FAQ

Are the indices zero-based?
Yes. The first item is at index 0, the second at 1, and so on. If you are used to one-based counting, subtract one when entering From / To.
Does To include the item at that index?
No - `To` is exclusive. `From = 2, To = 6` gives indices 2, 3, 4, 5 (four items). The item at index 6 is the first one NOT included.
Can I use negative indices?
Yes. `From = -3` starts three items from the end. `To = -1` ends just before the last item. Useful for tail slices when you do not know the exact list length.
What if From is greater than To?
The output is empty - the range is invalid. No error shown; just nothing in the output panel.
How does Every-Nth interact with the slice?
It applies after the slice. `From = 0, To = 10, Every-Nth = 3` first slices to items 0..9, then keeps every third item of that slice (indices 0, 3, 6, 9 of the slice output).