Text Sorter, Sort Lines Alphabetically Online
Sort a list of lines alphabetically, naturally, by length or numerically. Remove duplicates, shuffle, reverse and number lines, all in your browser.
Loading Text Sorter, Sort Lines Alphabetically Online… If nothing happens, please enable JavaScript.
A text sorter takes a list of lines and puts them in the order you want. Paste anything that is one item per line, a guest list, a set of keywords, log entries, filenames, CSV column values, package names, and the tool reorders it instantly. Alphabetical order is the obvious use, but it is rarely the only one you need: this tool also offers natural order (so file2 comes before file10), sorting by line length, sorting by the first number found in each line, reversing the current order, and a random shuffle. On top of the ordering you can strip surrounding spaces, drop blank lines, remove duplicate entries and number the result, which together cover most of the tidying a raw list needs before you use it somewhere else.
Frequently asked questions
Is my text sent to a server?
What is the difference between alphabetical and natural sorting?
How do I remove duplicate lines?
Does sorting handle accented characters and other alphabets?
Can I sort by number instead of by text?
Is the shuffle really random?
How many lines can it handle?
Why does my list look different after sorting even though I did not change the order option?
Can I sort words inside a single line instead of whole lines?
About Text Sorter, Sort Lines Alphabetically Online
The distinction between alphabetical and natural order is the one that catches people out most often. A plain alphabetical sort compares text character by character, so "file10.txt" lands before "file2.txt" because the character "1" comes before "2". Natural order understands that a run of digits is a number and compares 10 against 2 instead, which is what a human expects when looking at a folder listing or a set of numbered chapters. Both behaviours are correct for different jobs, so both are available here. The same applies to case: with "Ignore case" on, "apple" and "Apple" sit next to each other, which is usually what you want for names and words; with it off, capital letters group first, which matters when you are sorting code identifiers or comparing output against a case-sensitive system.
Using the tool is straightforward. Paste or type your list into the input pane, pick an order, and the output pane updates as you type. Toggle the options to remove duplicates, trim whitespace, drop blank lines or add line numbers. Then copy the result to your clipboard, download it as a .txt file, or press "Result to input" to feed it back in and apply a second pass, for example dedupe first and then shuffle. The shuffle is deterministic per click, so the same list stays put until you ask for another shuffle, and pressing "Shuffle again" gives a fresh random order.
Everything runs locally in your browser using JavaScript, so your list is never uploaded, stored or logged, and the page keeps working offline once it has loaded. That matters when the lines you are sorting are email addresses, customer names, internal hostnames or anything else you would rather not paste into a random web form. Comparison uses your browser's built-in Intl.Collator, which means accented characters and non-English alphabets sort according to proper locale rules rather than raw byte values, so "école" sorts next to "ecole" instead of being pushed to the end of the list.
Sorting Was the First Big Computing Problem
Putting things in order is one of the oldest jobs given to machines. Herman Hollerith's punched-card tabulators, built for the 1890 United States census, included sorting boxes that physically routed cards into bins so clerks could group them by attribute. Half a century later, mechanical card sorters were still the backbone of business data processing, and the word "sort" in computing carries that literal, physical origin: cards moving into separate stacks.
When stored-program computers arrived, sorting immediately became the most studied problem in the field. Merge sort was described by John von Neumann in 1945, one of the earliest non-trivial algorithms written for an electronic computer. Quicksort followed in 1959, invented by Tony Hoare while he was a visiting student in Moscow working on machine translation of Russian text, where he needed to look words up in a dictionary quickly. Donald Knuth eventually devoted an entire volume of The Art of Computer Programming, some 700 pages, to sorting and searching alone. There is a good reason for the attention: sorted data makes searching, deduplicating, merging and summarising dramatically cheaper, so a sort at the start often pays for itself many times over.
Text sorting has a second layer of difficulty that pure number sorting does not: deciding what "alphabetical" even means. Different languages disagree. Traditional Spanish treated "ch" and "ll" as single letters that sorted after "c" and "l". Swedish places a, ä and ö at the very end of the alphabet, after z. German phone books historically sorted ä as if it were spelled ae, while dictionaries sorted it as plain a. To settle this, the Unicode Consortium publishes the Unicode Collation Algorithm along with locale-specific tailorings, and that machinery is what browsers expose through Intl.Collator. When this tool sorts your list, it is quietly using a standard that encodes decades of argument about the alphabet.