Sorting a list of lines
Sorting a list by hand is slow and error-prone, whether it is a set of names, keywords, tags, file names or lines of configuration. This tool takes any text with one item per line and rearranges the lines in the order you choose. It does what the sort command or a spreadsheet's sort button does, with no setup and nothing to install, and you can combine it with simple clean-up steps.
The sort orders
- A to Z and Z to A: plain alphabetical order based on character codes. With "Ignore case" on, capital and small letters are treated alike, which is what people usually expect from an alphabetical list.
- Natural: treats embedded numbers as numbers, so item2 comes before item10. Plain alphabetical order would put item10 first because "1" comes before "2".
- Numeric: sorts by the number at the start of each line, ignoring text after it. Lines with no number go to the end.
- By length: shortest lines first, with ties sorted alphabetically.
- Reverse: flips the existing order without sorting.
- Shuffle: random order using a secure random source, useful for quizzes, playlists or draw order. Press Re-run to shuffle again.
Clean-up options
"Trim spaces" removes leading and trailing whitespace on each line, which prevents " apple" from sorting before "apple". "Remove blank lines" drops empty lines. "Remove duplicates" keeps the first occurrence of each line, and respects the case setting: with it on, "Apple" and "apple" are treated as the same line. These steps run before sorting, so the count shown in the result reflects the final list.
Limitations
Alphabetical sorting here is simple and does not follow language-specific rules, so accented letters such as é may sort after z in A to Z mode. Natural order uses your browser's locale-aware comparison, which handles accents better. For very large lists of hundreds of thousands of lines, a command-line tool will be faster. The tool runs in your browser, and your list is not uploaded.