Line Sorter & Duplicate Remover
Sort lines, remove or count duplicates, filter, trim, number, reverse or shuffle a list.
✓ 8 lines → 7 lines · 1 removed
About the Line Sorter & Duplicate Remover
Sort a list of lines and clean it up in one step. Sort A–Z or Z–A, naturally (item2 before item10), by the number in each line or by length; remove duplicate lines, keep only lines that appear once, show only the duplicates or count how often each line appears; keep or remove lines that contain a word; trim spaces, remove blank lines, number, reverse or shuffle the list.
How to use it
- Paste your list, one item per line.
- Choose what to do from the menu.
- Tick Ignore case, Trim spaces or Remove duplicates too if you need them.
- Check how many lines went in and came out, then copy or download the result.
Tip: Copy a column from Excel or Google Sheets and paste it here: each cell becomes one line. Paste the result back into the column when you're done.
Sorting options
Sorting leaves out empty lines, which would otherwise all pile up at the top.
- Sort A–Z / Z–A
- Alphabetical order using your language's rules, so accented letters sort next to plain ones (é with e).
- Sort naturally
- Numbers inside text are read as numbers: file2, file10, file100 instead of file10, file100, file2.
- Sort by number
- Sorted by the first number in each line, so 9 kg, 10 kg, 1,200 kg come in the right order. Lines without a number go last.
- Sort by length
- Shortest lines first, handy for finding short keywords or long titles.
- Remove duplicates too
- Sort and remove repeats in one step.
Duplicate tools
With Ignore case on, Apple and apple count as the same line. Spaces at the start and end of a line are always ignored when comparing.
- Remove duplicates
- Keeps the first copy of each line and the original order.
- Keep only lines that appear once
- Removes every line that has a duplicate, including the first copy: useful for finding the entries that are in only one of two merged lists.
- Show only duplicated lines
- Lists each repeated line once, to find duplicates in a list of emails, IDs or SKUs.
- Count how often each line appears
- Shows the count and the line, most frequent first, separated by a tab so it pastes into two spreadsheet columns.
Cleaning up lists
- Remove blank lines
- Deletes empty lines and lines with only spaces.
- Trim spaces
- Removes spaces and tabs at the start and end of every line, which often come with copied data.
- Keep lines containing…
- Type a word and only lines containing it remain, like a quick filter.
- Remove lines containing…
- The opposite: remove every line with that word, such as test entries or a blocked domain.
- Number the lines
- Adds 1., 2., 3. in front of each line, padded so they line up.
- Reverse and shuffle
- Turn the list upside down, or put it in random order for draws, quizzes or test data.
Two lists: find what's in both or only one
To find the items that two lists have in common, remove duplicates in each list first, paste both one under the other, and choose Show only duplicated lines. To find the items that are in only one of the lists, use Keep only lines that appear once instead. To see which list each item came from, compare the two lists with the Text Diff Checker after sorting both A–Z.
Everyday uses
- Email lists
- Remove duplicate addresses before importing a mailing list (tick Ignore case: emails are not case-sensitive).
- SEO keywords
- Merge keyword exports from several tools, remove duplicates and sort by length or A–Z.
- Code
- Sort imports, CSS properties, .gitignore entries or translation keys.
- Names and inventory
- Alphabetise names, tags, SKUs or file names, or count how often each appears.
How case and spaces are handled
With Ignore case on, lines are compared and sorted without regard to capital letters, but each line keeps its original spelling in the result: the first Apple is kept, not changed to apple. With it off, Apple and apple are different lines. Spaces at the start or end of a line never make two lines different when comparing, and Trim spaces also removes them from the result. Lines are split on any kind of line break, so lists copied from Windows, Mac or Linux files all work, and a final empty line at the end of a pasted file is ignored.
Tips and tricks
The note shows lines in and out, so you know at once how many duplicates or blank lines were removed.
Trim spaces first: “apple ” with a trailing space can look identical to “apple” but sort differently in other tools.
Turn a comma-separated list into lines first with find and replace in any editor (replace “, ” with a line break).
Remove duplicates keeps the original order, so the first, often the most important, entry stays.
Questions
How do I remove duplicate lines?
Paste the list, choose Remove duplicates and copy the result. Tick Ignore case if Apple and apple should count as the same.
How do I sort numbers correctly?
Choose Sort by number, or Sort naturally for text with numbers inside, like file names. Plain A–Z puts 10 before 9.
Can I sort by the second column?
Not directly. Move the column you want to sort by to the start of each line, or sort in a spreadsheet.
Is there a limit?
No fixed limit; lists of 100,000 lines sort in a moment on a normal computer.
Does it work with other languages?
Yes. Sorting follows the alphabet rules of your browser's language, for Urdu, Arabic, Chinese, accented European letters and more.
How do I remove duplicates but keep the order?
Choose Remove duplicates: the first copy of each line stays in its original place.
How do I put a list in random order?
Choose Shuffle. Each run gives a new random order, using every line once.
Is my text uploaded?
No. Everything runs in your browser; what you type, paste or open never leaves your device and nothing is stored on a server.
Related tools
Updated