Sort & Dedupe Lines
Sort lines alphabetically or naturally, remove duplicates and empties
About this tool
A line-processing workbench: paste any list and sort it alphabetically, in reverse, naturally (item2 before item10), by length, or shuffle it — while optionally trimming whitespace, dropping empty lines, and removing duplicates with order preserved. The removed-line count is reported so you can see exactly what deduplication did.
Natural sort is the option you will reach for most: plain alphabetical sorting puts "item10" before "item2" because it compares character by character, while natural sort compares embedded numbers numerically — the order humans expect for filenames, versions and IDs.
Deduplication keeps the first occurrence and preserves the original order of survivors, which matters when the list order is meaningful (imports, config lines, playlists). A case-insensitive mode treats "Apple" and "apple" as the same line.
Frequently asked questions
- What is the difference between alphabetical and natural sort?
- Alphabetical compares character codes, so "file10" < "file2" (because "1" < "2" at position 5). Natural sort recognizes digit runs and compares them as numbers, giving file2 < file10. Use natural for anything containing numbers.
- Does dedupe keep the first or last occurrence?
- The first. Lines are scanned top to bottom and a line is dropped only if an identical one (or case-equal, in case-insensitive mode) appeared earlier — so the surviving order matches the original.
- How large a list can this handle?
- Hundreds of thousands of lines are fine — operations are simple passes and a sort. Everything stays in browser memory, so the practical limit is your machine, not a server quota.
- Can I combine operations?
- Yes, and they apply in a sensible order: trim first, then remove empties, then dedupe, then sort — so " apple " and "apple" dedupe together when trim is on, and sorting always sees the cleaned list.