Sort Lines
Sort a list of lines alphabetically, numerically, by length or at random, with options for case sensitivity, removing duplicates and dropping blank lines.
Your text is processed locally in your browser and is not uploaded to our servers.
Sorted result
0 charactersSummary
What this tool does
Sorting a list by hand is tedious and error-prone. This tool orders any list of lines in the way you choose — alphabetical, numeric, by length, or shuffled — and can clean the list at the same time by removing duplicates and blank lines. It understands numbers the way people expect, so item2 comes before item10.
How to use it
- Paste your list, one item per line.
- Choose a sort order.
- Turn on Remove duplicate lines or Remove blank lines if you want to tidy the list while sorting.
- Copy the sorted result.
How the sort orders work
- A to Z and Z to A use your browser's locale-aware comparison, so accented letters and non-English alphabets sort correctly rather than being pushed to the end.
- Number, low to high / high to low reads the first number it finds in each line and sorts by value, so 3 apples and 12 pears order correctly even though "12" sorts before "3" as text. Lines with no number are placed at the end.
- Length sorts by the number of characters in each line, with alphabetical order breaking ties.
- Shuffle randomizes the order using an unbiased shuffle — useful for drawing names or randomizing test data.
- Reverse current order simply flips the list without sorting, which is handy for inverting a list that is already in a meaningful order.
With Natural number order on, embedded numbers within alphabetical sorting are compared by value, so file2, file10, file100 come out in that order rather than file10, file100, file2. Case sensitivity, duplicate removal and blank-line removal are applied before sorting, so the result is both ordered and clean.
Examples
Sorting banana, apple, Cherry, apple A to Z with duplicate removal on and case insensitivity gives apple, banana, Cherry.
Natural order matters for versioned names. Plain text sorting puts v1.10 before v1.9; natural order puts v1.9 first, which is what you want.
Numeric mode on a list like 3 apples / 12 pears / 1 melon sorts to 1 melon / 3 apples / 12 pears, reading the leading number in each line.
Common use cases
- Alphabetizing lists of names, terms, tags or references.
- Ordering file names or versioned identifiers with natural sort.
- Ranking numeric data pasted from a spreadsheet.
- Randomizing a list of participants or test cases.
- Deduplicating and sorting a keyword or email list in one step.
Privacy and security
Sorting runs in your browser. Lists of names, emails and data are never uploaded. Your options are saved locally. See the privacy policy.
Frequently asked questions
Why does my list sort item10 before item2?
That is plain text order, where "1" comes before "2". Turn on Natural number order and the tool compares the embedded numbers by value, so item2 comes before item10.
How does numeric sort handle lines with words and numbers?
It reads the first number it finds in each line and sorts by that value. Lines that contain no number are grouped at the end in alphabetical order.
Is the random shuffle truly random?
It uses a Fisher-Yates shuffle, which gives every ordering an equal chance. Each time you re-run it you get a fresh arrangement.
Can I sort and remove duplicates at the same time?
Yes. Turn on Remove duplicate lines and the list is deduplicated before it is sorted, so you get a clean, ordered result in one step.
Does sorting preserve the original if I need it back?
Your input box is unchanged, so the original list is always there. The sorted version appears in the result box, and Swap lets you move it back if you want to sort it again a different way.
Related tools
Tools that pair well with the Sort Lines.