Line Sorter & Deduplicator
Paste a list with one item per line to sort it A → Z, Z → A, in natural order (item2 before item10) or by length, reverse it, shuffle it or keep the original order. Remove duplicates, trim whitespace and drop empty lines in the same step, then copy or download the result. Everything runs in your browser.
How to use
- Paste your lines into the input box.
- Choose an Order: A → Z, Z → A, Natural, Length ↑, Length ↓, Reverse, Shuffle or Keep order.
- Tick or untick Remove duplicates, Trim whitespace on each line, Ignore empty lines and Case sensitive; the result updates as you type.
- Check the counts below the result, then click Copy or Download (sorted-lines.txt); in Shuffle mode, Reshuffle gives a new order.
Example
Input
Order: Natural · default options
file10.txt
file2.txt
File1.txt
file2.txt
file1.txtOutput
File1.txt
file2.txt
file10.txt
6 in · 3 out · 2 duplicates removed · 1 empty lines removedFrequently asked questions
Which copy of a duplicate is kept?
The first occurrence, with its original spelling. With Case sensitive off, lines that differ only in upper and lower case count as duplicates, so File1.txt is kept and file1.txt removed in the example. Duplicates are removed before sorting.
What is the difference between A → Z and Natural?
A → Z compares lines character by character, so file10.txt comes before file2.txt. Natural compares embedded numbers by value, so file2.txt comes before file10.txt.
Which language rules are used for sorting?
Sorting uses the collation rules of the current interface language, so accented letters are placed the way readers of that language expect. Length ↑ and Length ↓ sort by number of characters and use alphabetical order for lines of the same length.
What do Reverse and Keep order do?
Reverse flips the order of the lines without sorting them, and Keep order leaves them as they are, which is useful when you only want to remove duplicates, trim whitespace or drop empty lines.