Sort & Dedupe Lines
Guide: How to Clean Up Text Copied From PDFs and Websites
0 lines
Nothing you enter or choose here leaves your device. This tool runs in your browser.
Sorting, three ways
Take this short list: item10, Item2, apple, Banana, item1 and apple again. Here's what each setting does to it:
| Setting | Result, top to bottom |
|---|---|
| Sort A to Z (default) | apple, apple, Banana, item1, item10, Item2 |
| With natural number order | apple, apple, Banana, item1, Item2, item10 |
| With Case sensitive on | apple, apple, Banana, item1, item10, Item2 |
| Remove duplicates | item10, Item2, apple, Banana, item1 |
Look at item10 and Item2 in the plain sort. Text sorting compares character by character, so the 1 in item10 comes before the 2 in Item2. Natural order reads whole numbers as values, which puts item2 before item10, the way a person would. Turn it on for file names, versions and anything numbered.
What removing duplicates does
The first time a line appears it's kept, and later copies are dropped. The order of what's left doesn't change. Lines are compared ignoring case unless Case sensitive is on, so Apple and apple count as the same line by default.
A cleanup recipe for a messy list
Each action works on the result of the last one, so you can chain them. To clean up a pasted list of email addresses or names:
- Trim, to remove spaces at the start and end of each line.
- Remove empty lines.
- Remove duplicates.
- Sort A to Z.
If a step goes wrong, Undo steps back one action. Copy the result when you're happy.
Jobs that suit it
- Alphabetizing a bibliography, a guest list or a glossary.
- Deduplicating a column of ids, tags or domains pasted from a spreadsheet.
- Putting config entries, imports or CSS properties in order so they're easier to scan and to compare.
- Reversing a list that came out oldest-first.
- Getting two lists into the same order before comparing them with the text diff.
Things to watch
- Sorting ignores accents and case by default, so e and the same letter with an accent sit together.
- Each line is treated as text. Numbers without natural order sort as words, so 9 comes after 10.
- If one stray space sits at the start of a line, it sorts to the top. Trim first.
- Tens of thousands of lines are fine. Very large lists depend on your device's memory.
Your list stays in your browser. To turn the sorted lines into one row, use remove line breaks with a comma, and for edits across the whole list, try find and replace.
Written by Akinrinmade Michael · Updated October 24, 2026
How to use
- 1Paste your list into the box, one item per line.
- 2Choose whether sorting is case sensitive and whether numbers sort naturally.
- 3Click an action: sort A to Z, sort Z to A, reverse, remove duplicates, trim or remove empty lines.
- 4Click Copy, or Undo if you want to go back one step.
Frequently asked questions
What is natural number order?
It sorts numbers inside text by value, so "item2" comes before "item10" instead of after it.
Does removing duplicates keep the original order?
Yes. The first time a line appears it is kept, later copies are removed, and the order is unchanged. Duplicates are matched ignoring case unless "Case sensitive" is on.
Can I combine actions?
Yes. Each action works on the current text, so you can trim, then remove duplicates, then sort. Undo steps back one action.
Is there a limit on list size?
There is no fixed limit. Lists of tens of thousands of lines work fine, depending on your device.
Read the guide
Learn how this works and how to get the most from it.
Writing & text
How to Clean Up Text Copied From PDFs and Websites
Fix broken line breaks, double spaces and stray characters in copied text, then sort, number and tidy it in a few clicks.
3 min read
Related tools
Remove Line Breaks
Join lines into one paragraph. Strip breaks from copied text.
Add Line Numbers
Number every line of text, or strip existing numbers.
Find and Replace
Find and replace text online, with regex, case and whole-word options.
Text Diff Checker
Compare two texts side by side and see exactly what changed.