How to remove duplicate lines from a list

Lists collect repeats: an email address signed up twice, a keyword pasted from two sources, a name typed with and without a capital. Removing them by eye is slow and easy to get wrong. This guide shows a quick way to do it in the browser, how the matching rules change the result, and the same job in a spreadsheet or a terminal.

Open Duplicate Line Remover

Remove the duplicates

  1. Open the Duplicate Line Remover.
  2. Paste your list with one item on each line.
  3. Tick or clear the two options to set what counts as the same line.
  4. Press Copy result.

The first copy of each line is kept and later copies are removed, so the list stays in its original order. The page shows how many lines were removed. Your text stays in the browser tab and is not sent to a server.

What counts as a duplicate

Two options decide whether two lines are the same. Ignore upper/lower case treats Apple and apple as one item. Ignore spaces at the ends treats a line with a stray space after it as the same as the line without. The second option is on when the page opens.

The table shows one list of five lines under each combination: apple, Apple, apple followed by a space, banana, apple.

Ignore caseIgnore spaces at the endsLines keptLines removed
OffOn"apple", "Apple", "banana"2
OnOn"apple", "banana"3
OffOff"apple", "Apple", "apple ", "banana"1
OnOff"apple", "apple ", "banana"2

For email addresses, turn both options on. Addresses are not case sensitive in practice, and pasted lists often carry stray spaces.

Tidy the list before or after

  • To put the cleaned list in alphabetical order, paste it into Sort Lines.
  • To make every line the same case first, use the Case Converter.
  • To strip a prefix or a trailing comma from every line, use Find and Replace.

Only whole lines are compared. Two lines that differ by a comma or a full stop are different lines, so clean those up first if they should match.

The same job in other tools

WhereHow
ExcelSelect the column, open the Data tab and choose Remove Duplicates
Google SheetsSelect the column, then Data, Data cleanup, Remove duplicates
Terminal, sorted resultsort -u list.txt
Terminal, original order keptawk '!seen[$0]++' list.txt

The spreadsheet tools suit data that is already in a sheet. For a list copied from an email, a document or a web page, pasting it into the browser tool is quicker.

Frequently asked questions

Does it keep the first or the last copy?

The first. Later copies of the same line are removed.

Does the order of my list change?

No. The lines that remain stay in the order you pasted them.

Does it treat Apple and apple as the same?

Only if you tick Ignore upper/lower case. Without it they count as two different lines.

Is my list uploaded?

No. The work is done in your browser and nothing is sent to a server.