Sort Lines
Sort text lines alphabetically, by length, numerically, or randomly
Input (7 lines)
Sorted (7 lines)
About the Line Sorter
This tool sorts lines of text alphabetically, numerically, by length or randomly, ascending or descending. Numeric sorting compares values rather than characters, so 10 comes after 9 instead of landing between 1 and 2 as alphabetical sorting would put it.
Sort lines to make a list usable: alphabetising names for a directory, ordering a keyword list, arranging imports, or shuffling entries to pick a random winner.
Numeric mode matters more than it sounds. Alphabetical sorting compares character by character, so 10 lands between 1 and 2 — technically correct for text, useless for numbers. Numeric sorting reads each line as a value and orders it properly.
Sorting by length is handy for spotting outliers, such as the one truncated entry in an otherwise consistent export. Duplicate removal and empty-line dropping run in the same pass, and everything happens in your browser.
How to use the Line Sorter
- Paste your lines. Enter the list you want sorted.
- Pick a sort mode. Choose alphabetical, numeric, by length or random.
- Set the direction. Sort ascending or descending.
- Copy the result. Optionally remove duplicates and empty lines, then copy.
Line Sorter features
- Alphabetical A to Z or Z to A
- Numeric sort that compares values, not characters
- Sort by line length, shortest or longest first
- Shuffle into random order
- Optional trim, remove blank lines and remove duplicates
- Case-sensitive or case-insensitive
- Copy the result
Frequently asked questions
Why does alphabetical sorting put 10 before 9?
Because it compares character by character, and the character 1 sorts before 9. Numeric mode compares the values instead, which is what you want for anything that is actually a number.
What does case sensitivity change?
With it on, all capitalised entries sort before all lowercase ones, because uppercase letters come first in character order. Turn it off to get the ordering people expect, where Apple and apple sit together.
What is sorting by length for?
Finding outliers. Shortest-first surfaces blank or truncated entries; longest-first finds the values that will overflow a column or a field limit. Both are quicker than scanning a list by eye.
Can I deduplicate at the same time?
Yes, there are options to remove duplicates, drop blank lines and trim whitespace as part of the same pass, which is usually what a messy pasted list needs.