Array.slice semantics
Under the hood this is `Array.prototype.slice(from, to)` on your list's non-empty lines. `From` is inclusive, `To` is exclusive - the classic JavaScript / Python convention. Zero-based: `From = 0` means "start from the first item", `From = 2` means "start from the third item".
Leave `To` blank to slice to the end. Leave `From` blank or at `0` to start at the beginning. Negative indices are passed through to `slice` and count from the end (`From = -3` is "the last 3 items").
Every-Nth applies after the slice - set it to `2` and you get every other item from the sliced range, `3` gives every third, and so on. Default `1` keeps every item. Out-of-bound ranges return an empty result without error.
How to use extract a list fragment
- 1Paste one item per line into the input panel
- 2Set `From` (0-based, inclusive) - default `2`
- 3Set `To` (0-based, exclusive) - default `6`, blank means end
- 4Optionally set Every-Nth to stride through the sliced range
- 5Output updates live; out-of-bound indices return empty without error
Keyboard shortcuts
Drive ListShift without touching the mouse.
What this tool actually does
Array.slice with an optional Every-Nth stride.
`From` inclusive, `To` exclusive
`From = 2, To = 6` gives indices 2, 3, 4, 5 (four items). The item at index 6 is not included - matches JavaScript / Python slice semantics.
Zero-based indexing
The first item is at index `0`, not `1`. `From = 1` starts at the *second* item. If you think 1-based, subtract one everywhere.
Negative indices count from end
`From = -3` starts at the third-from-last item. `To = -1` ends before the last item. Great for "last N items" or "all but the last few".
Blank To means end of list
Leave `To` empty (or unset) to slice from `From` through the last item. Default sample has `To = 6` so the result is finite, but most real uses leave To blank.
Every-Nth stride after the slice
Every-Nth filters the sliced range by index. `2` = every other item (indices 0, 2, 4, ...), `3` = every third, and so on. Applied *after* slicing, so the stride is relative to the slice output.
Worked example
Default `From = 2`, `To = 6`, step = 1. Items at indices 2, 3, 4, 5 are returned (cherry, date, fig, grape).
apple banana cherry date fig grape
cherry date fig grape
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 (To is exclusive) | `cherry`, `date`, `fig`, `grape` |
| `From: 0`, `To: 3` | First three items | `apple`, `banana`, `cherry` |
| `From: -3`, `To: blank` | Last three items | `date`, `fig`, `grape` |
| `From: 0`, `To: blank`, `Every-Nth: 2` | Every other item, starting from index 0 | `apple`, `cherry`, `fig` |
| `From: 10`, `To: blank` (out of bounds) | No items to return | Empty output (no error) |