Text Sorter
Sort lines alphabetically or by length, remove duplicates and blanks
About Text Sorter
Sorts a list of lines alphabetically (with natural number order), by length, or shuffles them, with options to reverse the order, ignore case, and remove blank lines or duplicates — useful for cleaning up a pasted list before using it somewhere else, or just putting a long list into a consistent, predictable order.
Paste your list (one item per line), choose your sorting options, and copy the sorted result.
Leave "Natural numbers" on for file names and numbered items (item 2 comes before item 10). Turn "Ignore case" off only to separate Apple from apple (the capital version comes first); a lowercase word such as "apple" still sorts before "Banana". "Remove duplicates" follows the Ignore case and Trim spaces settings and keeps the first copy.
Watch: Text Sorter in Action
- Why isn't my mixed-case list sorting the way I expect?
- Turn on "ignore case" if your list mixes capitalized and lowercase entries — without it, capital letters sort before lowercase ones in standard alphabetical order, which often isn't the order you actually want.
- Does Remove duplicates keep the first or the last copy?
- The first. Lines are compared after trimming, and in lower case when Ignore case is on, but the line that stays is the original first occurrence with its own capitalisation. Later matching lines are removed before any sorting happens.
- What does Natural numbers do?
- With it on, digits are compared by value, so item 2 comes before item 10. With it off, comparison is character by character and item 10 comes before item 2 because 1 sorts before 2. Leave it on for file names and numbered lists.
- How does Sort by Length decide between lines of equal length?
- Shorter lines come first, and lines with the same length are ordered alphabetically using the same rules as Sort Alphabetically. Turn on Reverse (Z to A) to get the longest lines first.
- Can I get my original list back?
- Yes, once. Undo appears after any action and restores the text from just before the last button press. It does not keep a history, so run Copy Result or keep your own copy before experimenting with several changes.
- What does Clean only (keep order) do?
- It applies Trim spaces, Remove blank lines and Remove duplicates as ticked, and leaves the order alone. If Reverse is switched on it flips the list. The summary line reports how many lines were removed.
How to use Text Sorter
Paste or type your list into the box with one item per line. Set the switches first: Reverse (Z to A), Ignore case, Natural numbers, Trim spaces, Remove blank lines and Remove duplicates. Then press the action you want. Sort Alphabetically orders lines A to Z, Sort by Length puts the shortest lines first, Shuffle randomises the order, and Clean only (keep order) applies the trimming, blank-line and duplicate settings without reordering anything.
The result replaces the text in the box, and a line underneath reports how many lines went in and how many came out. Copy Result copies the box contents, and Undo brings back what you had before the last action.
When to use it
Good for tidying a pasted list of names, tags, keywords, file names, ingredients or log entries before it goes into a spreadsheet or document. Shuffle helps when you need a random order for a speaking rota or a casual raffle list, and Clean only is useful when the order matters but stray spaces, empty rows and repeated lines must go.
When not to use it
It sorts whole lines, so it cannot sort by a column, a second field or a date inside each line; a spreadsheet handles that properly. Shuffle relies on the browser's ordinary random generator, so do not use it for a draw whose fairness must be audited, such as a prize with legal rules. For prices or decimals, test a small sample first.
Tips for best results
Order of operations matters: trimming and blank-line removal happen first, duplicates are then dropped keeping the first copy, and sorting runs last. Press Clean only with Reverse switched on when you just want the list flipped. Sort by Length breaks ties alphabetically, so reversing it gives longest first. Ignore case also makes accented letters sort as their plain letter, so e and the accented e compare as equal.
Limitations
Lines are the only unit. Length is measured in characters as the browser stores them, so some emoji and rare symbols count as two. Alphabetical order follows your browser's language settings, so accented or non-Latin text can come out differently on different devices. Duplicates must match the whole trimmed line, so near-matches stay. Undo remembers only the last action, and Reverse has no effect on Shuffle.
Privacy
Sorting runs on the lines in the box using your browser's built-in comparison and random functions. Your list is not uploaded, and neither the original nor the sorted version is saved by the tool; Undo holds one earlier copy in the page's memory until you close it. Copy Result writes to your clipboard only when you press it. The site counts a use of the tool but not its text.
More from Text & Writing: