Group by trailing character, alphabetical tiebreak
The comparator reads the final character of each line (`[...s].at(-1)` - Unicode-aware, so surrogate-pair emoji and supplementary-plane characters stay intact instead of being split mid-code-point). Items are grouped by that character, and items whose last character is equal fall back to full-line alphabetical order for a stable, human-readable result.
Example: `apple / dog / banana / cat / fox / elephant` becomes `banana` (a), `apple` (e), `dog` (g), `cat` (t), `elephant` (t), `fox` (x). The two "t" items keep alpha order among themselves via the tiebreak.
Mode also exposes whole-line alphabetical, numeric, and by-length so the same tool can handle ordinary sort jobs too. Case sensitive off (default) treats `Apple` and `apple` as equal on the tiebreak; turn on to distinguish them.
How to use sort list by last character
- 1Paste your list into the input panel
- 2Default Mode is "By last character"; leave it to sort by trailing character
- 3Ascending (default) groups a-z by last char; Descending reverses that ordering
- 4Within a group of same-last-char items, the alphabetical tiebreak orders them consistently
- 5Switch Mode to Alphabetical / Numeric / By length for other sort axes
Keyboard shortcuts
Drive ListShift without touching the mouse.
What this tool actually does
Native last-character sort with alphabetical tiebreak. Unicode-aware.
Groups by trailing character
The comparator reads `[...line].at(-1)` from each item - the final Unicode code point. Items with the same last character come out next to each other; the group order is alphabetical on that character (a before b before c, etc.).
Alphabetical tiebreak within a group
Two items sharing a last character fall back to full-line `localeCompare` for their relative order. `cat` and `elephant` both end in "t"; in the output `cat` comes before `elephant` because c < e. Keeps output deterministic across runs.
Unicode-aware last-char extraction
Uses the spread operator (`[...line]`) which iterates by code point, not by UTF-16 code unit. Items ending in emoji or supplementary-plane characters stay intact instead of being split mid-surrogate-pair.
Four modes via the shared sort op
By last character (default), Alphabetical (whole line), Numeric, or By length. Pick the mode that matches your sort key; all four share the same Order + Case-sensitive controls.
Case sensitive toggle
Off (default) groups `cat` and `CAT` together (both end in "t" regardless of case). On distinguishes `T` from `t` in the grouping. Also affects the tiebreak.
Worked example
Default By-last-character mode. Items grouped by trailing letter (a → e → g → t → x); ties on "t" broken alphabetically so `cat` comes before `elephant`.
apple dog banana cat fox elephant
banana apple dog cat elephant fox
Settings reference
How each option shapes the output using the sample above.
| Setting | What it does | Effect on the sample |
|---|---|---|
| Mode: By last character (default), Order: A→Z | Groups items by trailing character; alphabetical tiebreak | `banana` (a) / `apple` (e) / `dog` (g) / `cat` (t) / `elephant` (t) / `fox` (x) |
| Mode: By last character, Order: Z→A | Reverses the grouping order (x before t before g...); tiebreak still alphabetical within a group | `fox` / `cat` / `elephant` / `dog` / `apple` / `banana` |
| Mode: Alphabetical (whole line) | Standard full-line alpha sort (same op as Sort a list) | `apple` / `banana` / `cat` / `dog` / `elephant` / `fox` |
| Mode: By length | Sorts by character count with alphabetical tiebreak | `dog` (3) / `cat` (3) / `fox` (3) / `apple` (5) / `banana` (6) / `elephant` (8) |
| Case sensitive: on | Distinguishes `T` from `t` in grouping and tiebreak | No visible change on the sample - all items lowercase |