Sort Lines Alphabetically (Or by Length, Number)
Sort any text block by lines — alphabetical (case-sensitive or not), length, numerically (for lists of numbers), or reverse. Optional deduplication. Useful for cleaning todo lists, sorting CSV columns, organizing imports.
How to use the Sort Lines Alphabetically (Or by Length, Number)
Paste lines and choose a sort mode — alphabetical, by length, numeric, or natural (so 2 comes before 10). Optionally reverse the order, make it case-sensitive, or deduplicate as you sort. Copy the result.
Sorting lines the way you actually need
A plain alphabetical sort is rarely all you want. Numbers sort wrong lexically — 10 lands before 2 — filenames with digits need “natural” order to read sensibly, and sometimes it is length or reverse order that matters. Doing these in an editor is awkward and inconsistent.
This sorts a block of lines four ways — alphabetical, by length, numeric, or natural — with reverse, case-sensitivity, and dedupe as independent options. To remove duplicates without reordering, see deduplicate lines; to compare two lists for shared and unique entries, compare two lists.
Common use cases
- Tidying lists — alphabetize a todo list, an import block, or a word list.
- Numeric sorting — order a column of numbers by value rather than by digit.
- Natural order — sort
file-1,file-2,file-10the way a person expects. - Longest first — surface the longest lines by sorting on length and reversing.
- Dedupe-and-sort — clean and order a messy list in a single step.
Frequently asked questions
What is “natural” sort?
file2 comes before file10 instead of after it.Why use numeric instead of alphabetical for numbers?
10 before 2. Numeric compares by value, which is usually what you want.Can it sort and deduplicate at once?
Is the sort case-sensitive?
Apple and apple sort together. Enable case-sensitive to separate upper- and lower-case.