Sort and dedupe lines
Runs entirely in your browser. Your files and data never leave your device.
10 lines in · 5 out · 5 removed
About this tool
Paste a list, get it back sorted and cleaned up. This tool sorts lines, removes duplicates, trims stray spaces, and drops blank lines. A counter under the panes tells you how many lines went in, how many came out, and how many were dropped.
Is my data uploaded anywhere?
No. The sorting happens in your browser using ordinary string operations. Nothing you paste leaves the page, so a list of customer emails or internal hostnames is as safe here as it is in your own text editor.
What do the sorting options do?
There are six. “Keep original order” leaves the lines where they are, which is useful when you only want to remove duplicates. “A to Z” and “Z to A” sort alphabetically. “Natural” reads runs of digits as numbers, so item2 lands before item10 instead of after it. “Shortest first” and “longest first” sort by how many characters a line has, and ties fall back to alphabetical order so the result is always the same. There is also a reverse switch that flips whatever order you ended up with.
Comparison uses the browser’s own Intl.Collator, so accented letters sort next to their base letter rather than getting exiled to the end of the list. Line length counts code points, which means an emoji counts as one character instead of two.
In what order are the options applied?
Trimming runs first, then blank lines go, then duplicates, then the sort, then the reverse switch. The order matters. Because trimming comes before deduplication, apple and apple collapse into one line when trimming is on and stay separate when it is off. Deduplication keeps the first occurrence of each line and discards the rest.
“Ignore case” applies to both sorting and deduplication. With it on, Apple and apple count as the same line, and the first spelling you typed is the one that survives.
One thing to know about line endings: the output always uses \n. If you paste text that came from a Windows editor with CRLF endings, you get LF endings back.
Where does this come up?
Cleaning up a list of email addresses before an import, tidying a .gitignore, sorting CSS class names, deduplicating log lines, or putting a shopping list in a sensible order. Anything that is one item per line and slightly messy.