Remove duplicate lines

Paste a list to remove repeated lines and sort what’s left. Ignore case or extra spaces if you like, and see exactly which lines were repeated.

Keep
Your list
Result
Paste a list, one item per line

How it works

The tool reads your text one line at a time. Each line is compared with every line before it, and if it’s the same, it’s a duplicate. With Remove duplicates on, only one copy of each line is kept. Everything else about the line, including its spelling and punctuation, stays as you typed it.

Two lines count as the same when they match exactly, after these optional tidy-ups:

  • Trim line ends (on by default) ignores spaces and tabs at the start and end of each line, so “ Oliver” and “Oliver” match.
  • Ignore case treats capitals and small letters as the same, so “Amelia” and “amelia” match. It also handles letters like the German ß (which matches “SS”) and Greek final sigma.
  • Ignore extra spaces treats any run of spaces or tabs inside a line as one space, so “New York” and “New York” match.

Accented letters always match however they were typed. An “é” can be stored as one character or as an “e” followed by an accent, and the two look identical, so they’re treated as the same.

Empty lines are never counted as duplicates. With Remove empty lines on, they’re taken out; with it off, they’re left where they are.

A worked example

Say your list is apple, Banana, apple, cherry, banana, apple, one per line. That’s 6 lines. With the default settings, the result is apple, Banana, cherry, banana: 4 lines, with 2 repeated copies removed. “Banana” and “banana” are both kept, because capitals count.

Turn on Ignore case and the result is apple, Banana, cherry. “banana” is now a repeat of “Banana”, and the first spelling is the one that stays.

Sorting lines

Duplicates are removed first, then the lines are sorted. Pick an order from the Sort menu:

SortWhat it doesExample
A to ZAlphabetical, ignoring case. Accented letters sort with their plain letter, so “élan” sits with the e’s.Item 1, Item 10, Item 2, Item 20
A to Z, numbers in orderAlphabetical, but runs of digits are read as numbers. Best for file names, versions and numbered items.Item 1, Item 2, Item 10, Item 20
By numberBy the first number in each line, including minus signs, decimals and commas. Lines with no number go to the end.-3, 2.5, £1,250, none
By lengthShortest first, counting each emoji or accented letter as one character. Lines of equal length go A to Z.a, bb, ccc
Reverse orderTurns the list upside down, without sorting it.third, second, first
ShuffleA random order, using your browser’s secure random number generator.different every time

For A to Z, numbers in order, by number and by length, tick Largest or Z first to sort the other way.

Common mistakes

  • Lines that look the same but aren’t. A trailing space, a double space or a capital letter makes a line different. If you expected more duplicates, try Ignore case and Ignore extra spaces.
  • Invisible characters. Text copied from web pages or Word can contain zero-width spaces and non-breaking spaces you can’t see. Run it through the text cleaner first, then remove duplicates here.
  • Items separated by commas. This tool works line by line. If your list is “a, b, c” on one line, use find and replace to turn each comma and space into a new line first.
  • Sorting numbers A to Z. Plain A to Z puts “10” before “2”, because 1 comes before 2. Use A to Z, numbers in order, or By number.

Related tools

To count how often each word appears in a piece of writing, rather than each line, use the word frequency counter. To pick winners or make teams from a list of names, use the random name picker. The word counter shows how many lines, words and characters you have.

Your list stays private

Everything happens in your browser. Your list isn’t uploaded, logged or stored on a server. It’s kept in this browser tab only, so a refresh doesn’t lose it, and it’s gone when you close the tab.

Questions people ask

How do I remove duplicate lines?
Paste your list into the box, one item per line. Repeated lines are removed straight away, keeping the first copy of each, and the result appears on the right. Use Copy to take it away.
Is it case-sensitive?
Yes, by default. “Apple” and “apple” are kept as two different lines. Turn on Ignore case to treat them as the same, and the first spelling is the one that’s kept.
Does it keep my list in order?
Yes. With Sort set to Keep order, the lines that are left stay in the order they first appeared. Choose Last copy to keep each line where it last appears instead.
How do I sort lines alphabetically?
Choose A to Z from the Sort menu. To put “Item 2” before “Item 10”, choose A to Z, numbers in order. Tick Largest or Z first to sort the other way.
Can I see which lines were repeated?
Yes. Under the tool, open the list of repeated lines to see each one and how many times it appeared, most repeated first. This works even with Remove duplicates turned off.
Is my list sent anywhere?
No. Everything happens in your browser and nothing is uploaded. Your list is kept in this tab only, so a refresh doesn’t lose it. Share links include your settings, never your list.
↑↓ move↵ openesc close