197 tools

Text Tools · · 4 min read

How to Remove Duplicate Lines from a List (and Sort It Too)

Paste any list into a free tool that trims, drops blank lines, removes duplicates, sorts A–Z or by length and numbers the result — nothing is uploaded.

To remove duplicate lines from a list, paste it into Sort & Dedupe Lines — by default it trims whitespace, drops blank lines and removes duplicates as you type. You can also sort the result A→Z, Z→A or by length, reverse the order, or number each line, entirely in your browser.

What Sort & Dedupe Lines does

It takes any block of text — one item per line — and cleans it up: a spreadsheet column, a list of email addresses, keywords for a campaign, a copy-pasted mailing list. Six toggles (Trim, Remove empty, Remove duplicates, Ignore case, Reverse, Number) and a sort choice (None, A→Z, Z→A, Length) combine to turn a messy paste into a clean list, and the output updates live as you change any setting.

How to remove duplicate lines with Toolbench

  1. Open Sort & Dedupe Lines.
  2. Paste your list into the Input box, one item per line.
  3. By default, Trim, Remove empty and Remove duplicates are already on — whitespace is trimmed from each line, blank lines are dropped, and repeated lines are reduced to their first occurrence.
  4. Turn on Ignore case if Apple and apple should count as the same line for deduping (and for sorting).
  5. Pick a sort under Sort: None keeps the order you pasted, A→Z or Z→A sorts alphabetically, and Length sorts shortest to longest.
  6. Turn on Reverse to flip the final order, and Number to prefix each line with 1., 2., and so on — numbering is applied last, so it reflects whatever order you end up with.
  7. Check the Output · X → Y lines label to see how many lines you started with and how many remain, then click Copy, or use Send to → to pass the result straight into another Toolbench tool.

Worked example

The tool's own placeholder is a good example. Paste this:

banana
apple
apple
cherry

With the default toggles (Trim, Remove empty and Remove duplicates on, Sort set to None), the second apple is dropped and the original order is kept:

banana
apple
cherry

The status label reads 4 → 3 lines. Click the A→Z sort pill on that same result and it becomes:

apple
banana
cherry

Sort modes

Sort What it does
None Keeps the order you pasted (after trimming, blank-line removal and deduping)
A→Z Alphabetical order
Z→A Reverse alphabetical order
Length Shortest line to longest; lines of equal length fall back to alphabetical order

A→Z and Z→A compare numbers inside the text numerically, not character by character — so item2 sorts before item10, instead of the usual text-sort mistake of item10 coming first.

Tips and common mistakes

  • Duplicates keep the first occurrence, not the last. If two lines are identical (or count as identical under Ignore case), the copy further down the list is the one that gets dropped.
  • Ignore case affects both deduping and sorting. With it on, Apple, apple and APPLE collapse into one line, and A→Z/Z→A sorting stops treating uppercase and lowercase as different.
  • A line made only of spaces still counts as empty. Remove empty checks the line after trimming, so a line with just whitespace is dropped along with truly blank lines.
  • Number reflects the final order. If you sort or reverse the list and then turn on Number, the numbers follow the sorted/reversed order — turn Number on last if you want to double-check that.
  • Want to keep your original order? Leave Sort on None — trimming, blank-line removal and deduping still run, but nothing gets reordered.
  • Text Cleaner — strip HTML, smart quotes and stray whitespace from messy pasted text before you work with it as a list.
  • Text Diff — compare two versions of a list line by line to see exactly what changed.
  • Find and Replace — swap out a word or pattern across a whole list at once, with an optional regex mode.
  • Word Counter — count words, characters and lines in text.

Frequently asked questions

Is my list uploaded when I use this tool?

No. Sorting and deduplicating happen in your browser as you type. If you're signed in, your input syncs privately to your account so it's there next time; if you're signed out, nothing is saved anywhere.

Does it keep the first or the last copy of a duplicate line?

The first one. When a line repeats further down the list, that later copy is the one removed.

Can I sort a list that has numbers in it, like "Item 2" and "Item 10"?

Yes. A→Z and Z→A sort those numbers by their value, so Item 2 comes before Item 10 instead of after it, which is what a plain character-by-character sort would do.

Will it remove lines that only have spaces on them?

Yes, if Remove empty is on (it is by default). A line is treated as empty once its whitespace is trimmed away, even if it wasn't truly blank to begin with.

How do I clean a list without changing the order it's in?

Leave Sort set to None. Trim, Remove empty and Remove duplicates still run if they're switched on, but the remaining lines stay in the order you pasted them.

More guides

All guides →