Sort Lines

Sort lines alphabetically, ascending or descending.

About Sort Lines

Sort Lines orders the lines of your input alphabetically — a standard lexicographic comparison, character by character. The default is ascending order (A→Z, 0→9 by codepoint); flip the toggle for descending. The line count is preserved exactly: nothing is added or removed, only reordered.

This is the right tool for stabilising a list before diffing two text files, alphabetising imports or env-var names, organising a TODO list by name, or producing a deterministic order that survives copy-paste between machines. Note that lexicographic order compares character by character, so `2.txt` sorts after `10.txt` because `2` is greater than `1` at the first differing position. If your list contains embedded numbers — versions, file names, ticket IDs — and you want `2` before `10`, use Natural Sort Lines instead.

Examples

Input
cherry
apple
banana
Output
apple
banana
cherry

Ascending lexicographic order. Switch to descending to reverse the comparison.

Frequently asked questions

Are duplicates removed when sorting?

No. Sort Lines only reorders. If you want unique sorted lines, run Remove Duplicate Lines before or after — the operations compose cleanly.

Is the comparison case-sensitive?

Yes by default — uppercase letters sort before lowercase ones in standard lexicographic order, so `Banana` sorts before `apple`. Use the case-insensitive option in the comparison bar to fold both into the same order.

How does it handle leading whitespace?

Whitespace is part of the comparison; a line beginning with a space sorts before a line beginning with a letter. Run Trim Each Line first if leading whitespace is incidental.

Why does `item10` come before `item2`?

Because string comparison reads `i`, `t`, `e`, `m`, then compares `1` vs `2` — and `1` is less than `2`, so `item10…` is less than `item2…`. For human-friendly numeric ordering, use Natural Sort Lines.