Sort lines alphabetically

Sort lines alphabetically takes a list of lines and reorders them ascending (A to Z) or descending (Z to A). Optional toggles control case-sensitivity, natural ordering (so item-2 sorts before item-10), and de-duplication. Useful for cleaning name lists, alphabetising imports / requirements files, sorting word banks, and prepping data before deduplication or counting. The transformation runs in your browser; nothing uploads.

Input
Line 1:1 LF cloud_done Saved locally
Result Sort Lines Alphabetically
0 lines 0 chars

Five toggles for the four common sort variants

The default sort is case-insensitive ascending with natural ordering. That covers the most-asked-for shape: alphabetise a list of names, requirements, items, or steps, with numbers in numeric order rather than ASCII order. Output is one line per item, matching the input shape.

Four toggles cover the variant cases. Order picks ascending (A to Z) or descending (Z to A). Match Case on flips to ASCII-style sort where uppercase letters precede lowercase (Delta sorts before delta); off groups them together. Natural Sort on (the default) sorts numbers by value so item-2 comes before item-10; off treats the whole line as a string so item-10 sorts before item-2 (because 1 < 2 as characters).

Dedupe on drops duplicate lines (case-insensitive unless Match Case is on). Drop Blank on (the default) removes empty lines from the output. Combine all four for a "clean and alphabetise" pass: paste a messy list, get back a sorted, deduped, blank-line-free version.

How to use sort lines alphabetically

  1. 1Paste your lines into the input panel, one item per line.
  2. 2Pick an Order: ascending (A-Z, default) or descending.
  3. 3Toggle Match Case if your sort needs to be case-sensitive.
  4. 4Toggle Natural Sort off only if you actually want lexicographic item-10 before item-2.
  5. 5Toggle Dedupe on to drop duplicate lines.
  6. 6Click Copy to copy the sorted result.

Keyboard shortcuts

Drive TextResult without touching the mouse.

Shortcut Action
Ctrl FOpen the find & replace panel inside the input Plus
Ctrl ZUndo the last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor Plus
EscClose find & replace, or exit fullscreen
Ctrl KOpen the command palette to jump to any tool Plus
Ctrl SSave current workflow draft Plus
Ctrl PRun a saved workflow Plus

What this tool actually does

Locale-aware sort via Intl.Collator

Uses the browser's Intl.Collator for the comparison so accented letters and non-ASCII text sort correctly per the user's locale. café sorts near cafe rather than landing among the punctuation symbols at the wrong end of the list.

Natural sort for numbered items

When Natural Sort is on, runs of digits inside lines are compared numerically. chapter-2 sorts before chapter-10; raw lexicographic sort would put chapter-10 first because 1 < 2 as characters. Default on because it matches what users almost always want.

Case-insensitive by default

Default is case-insensitive: alpha, Bravo, charlie sort as alpha, Bravo, charlie in the natural reading order. Turn Match Case on to use ASCII order where capitals come first.

Dedupe + drop blank

Dedupe filters duplicate lines (using the same case rule as the sort comparator). Drop Blank (on by default) removes empty / whitespace-only lines from the output, since they almost always survive paste-from-spreadsheet shenanigans.

Worked example

Default options: ascending, case-insensitive, natural sort. Note item-2 precedes item-10.

Input
charlie
alpha
bravo
item-2
item-10
item-1
Output
alpha
bravo
charlie
item-1
item-2
item-10

Settings reference

Setting / behaviour Effect on output
Order = Ascending (default) Sort A to Z. Numbers ascend in natural order if Natural Sort is on.
Order = Descending Sort Z to A. Same comparator, reversed.
Match Case = off (default) Case-insensitive. alpha and Alpha sort together.
Match Case = on Case-sensitive. ASCII order means uppercase precedes lowercase: Delta sorts before delta.
Natural Sort = on (default) item-2 before item-10. Digit runs compare numerically.
Natural Sort = off item-10 before item-2. Raw lexicographic comparison.
Dedupe = on Drops repeat lines. Repeat detection respects Match Case.
Drop Blank = on (default) Empty / whitespace-only lines are removed from the output.

FAQ

Why does case-insensitive sort group "Alpha" with "alpha"?
Most users want a case-insensitive sort for human-readable lists - it groups "Alpha" with "alpha" instead of separating them by capitalisation. Turn on Match Case for the strict ASCII-style sort where capitals always come first.
How does this compare to dedupe-lines?
This tool sorts AND optionally dedupes in one pass. Find unique words and other dedupe-only tools preserve original order; this one always reorders. Use this when you want sorted+deduped; use the dedicated dedupe tool when you want unique-only with original order kept.
What does natural sort do for me?
Natural sort treats embedded numbers as numbers. chapter-2, chapter-10, chapter-3 sort as 2, 3, 10 (natural) rather than 10, 2, 3 (lexicographic). On by default because it matches reader expectation. Turn it off if you genuinely want raw character-by-character comparison.
Will it sort emoji or non-Latin scripts?
Yes - the sort uses Intl.Collator which is locale-aware and handles non-Latin scripts correctly. Emoji sort by Unicode codepoint within their block. Mixed-script lists may sort in surprising orders depending on the user's locale.