Find longest and shortest list items

Find the top N longest and top N shortest items in a list by character count. Default N=3 with lengths shown in parentheses. The tool prints two sections (`Longest N:` and `Shortest N:`) with each item indented below. Ties preserve original input order. Same content-agnostic approach as Sort by length.

Input
Ready
Output
Live

Two-column extremes report

The op sorts items by length twice (descending for longest, ascending for shortest) and slices the top N from each. Output format: `Longest N:` header, then each item on its own line with two-space indent. Same structure for the `Shortest N:` section. With N=1, headers become `Longest:` / `Shortest:` (no number).

Show length (default on) appends `(N)` to each item with its character count. Turn off for cleaner output when you just want the item text.

Items can appear in BOTH sections if the list is short - with 5 items and N=3, there is overlap. For distinct longest/shortest with no overlap, choose N ≤ floor(list length / 2).

How to use find longest and shortest list items

  1. 1Paste your list into the input panel
  2. 2Set Top N each - default is 3 (shows 3 longest + 3 shortest)
  3. 3Toggle Show length to append character counts in parentheses
  4. 4For length-sorted output instead of extremes, use Sort by length
  5. 5For statistics summary, use List analysis

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

Top-N extremes report, two sections.

Top N longest and top N shortest

Computes two slices from the length-sorted list: first N from descending sort (longest), first N from ascending sort (shortest). Both use stable sort - ties preserve original order.

Two-section output

Format: `Longest N:\n item1 (len)\n item2 (len)\n...\nShortest N:\n item1 (len)\n...`. With N=1, headers drop the number suffix.

Show length toggle (default on)

Appends ` (N)` to each item with its character count. Turn off for unadorned item text.

Overlap on short lists

With 5 items and N=3, the same item can appear in both sections. Pick N ≤ floor(length / 2) for non-overlapping output.

Blank lines skipped

Whitespace-only lines are filtered before analysis - they do not count as "shortest" (a zero-length tier).

Worked example

Default N=3, Show length on. `apple` (5) appears in both sections due to overlap on 5-item input.

Input
apple
banana
kiwi
watermelon
pear
Output
Longest 3:
  watermelon (10)
  banana (6)
  apple (5)
Shortest 3:
  kiwi (4)
  pear (4)
  apple (5)

Settings reference

How each option shapes the output using the sample above.

Setting What it does Effect on the sample
Top N each: 3 (default), Show length: on Top 3 longest + top 3 shortest with counts See example above - overlap on `apple`
Top N each: 1 Just the extremes `Longest:\n watermelon (10)\nShortest:\n kiwi (4)`
Show length: off Removes the ` (N)` suffix Items listed without character counts
Ties (automatic) Preserve original input order `kiwi` before `pear` - both length 4, kiwi appeared first

FAQ

Can the same item appear in both sections?
Yes, if the list has fewer than 2N items. With 5 items and N=3, the middle item overlaps. Pick a smaller N or chain Dedupe on the output to remove overlaps.
How are ties broken?
Stable sort preserves original input order. Two items with the same length appear in the order they were entered.
What about blank lines?
Filtered out before analysis. A line with only whitespace is not treated as "length 0" - it is simply excluded.
How is this different from Sort by length?
Sort by length returns the entire list sorted. This tool returns only the top N extremes at each end, with headers and length annotations.
Can I see just the longest or just the shortest?
Not directly - both sections always print. For longest-only, chain Head on the output lines under `Longest`. For shortest-only, use Tail.