Remove Duplicate Lines

Paste a list and every repeated line is removed, keeping the first occurrence in its original order.

1 duplicate removed

Last reviewed:

Where duplicate lines come from

Duplicates appear whenever two lists meet. You merge sign-up sheets from the bake sale and the car wash, combine contacts exported from two phones, or paste keyword lists from three colleagues. Error logs repeat the same line hundreds of times. The fastest fix is to remove exact repeats first and only then look for near-misses by eye.

Unique lines = Total lines − Lines removed
If you also drop empty lines, those count toward the lines removed

Example: Merging two volunteer lists

  1. Bake sale list: 30 names, car wash list: 25 names
  2. Combined: 55 lines
  3. Removed as duplicates: 9

46 different volunteers signed up across both events.

How the matching options change the result

Two lines count as duplicates only if they match after the options you choose. Ignoring case treats Apple and apple as the same. Trimming ignores spaces at the start and end of each line. Here's one messy list run four ways: Apple, apple (with a trailing space), Banana, two empty lines, banana, Cherry.

SettingsResultLines removed
Ignore case, trim, remove empty linesApple, Banana, Cherry4
Case sensitive, trim, remove empty linesApple, apple, Banana, banana, Cherry2
Ignore case, no trim, remove empty linesApple, apple (with space), Banana, Cherry3
Ignore case, trim, keep empty linesApple, Banana, two empty lines, Cherry2

Notice two details. The first spelling wins: if “Apple” comes before “apple”, the capitalized one stays. And empty lines are never treated as duplicates of each other, so paragraph gaps survive unless you choose to drop them.

Invisible differences that stop a match

Sometimes two lines look identical and both survive. The cause is almost always a character you can't see. Text from web pages and word processors is full of them, and a single one is enough to make the lines different.

  • Non-breaking spaces instead of normal ones, common in text copied from websites.
  • Curly apostrophes versus straight ones: O’Brien and O'Brien are different lines.
  • Accented letters stored two ways. An é can be one character or an e plus a combining accent, and they look the same on screen.
  • Tabs where you expected spaces, or two spaces between first and last name.

Run Remove Extra Spaces first to standardize spacing, then use find and replace to swap curly apostrophes for straight ones. True near-duplicates such as “Jon Smith” and “John Smith”, or “Smith, John” and “John Smith”, need a human decision. Putting the list in alphabetical order with Sort Lines makes them sit side by side.

Cleaning up an email list

Email lists are where case matters most. The part after the @ is never case-sensitive. The part before it technically may be, according to the email standard, but the same standard discourages relying on that, and in everyday use Maria@ and maria@ reach the same inbox. Leave case sensitivity off for email lists.

Put one address per line before you start. If the export includes names next to the addresses, two entries for the same person with different name spellings won't be caught, so remove the name column first.

Checking the number removed is a useful sanity test. If 400 lines go in and 380 come out, that's plausible. If 400 go in and 12 come out, the list probably had one address per row repeated by a spreadsheet formula, and it's worth looking at the original.

Removing duplicates from a spreadsheet column

Copying a single column out of a spreadsheet, cleaning it here and pasting it back is quick, and it works well when that column stands alone, like a list of tags or a column of email addresses you're about to import somewhere else.

It goes wrong when the column belongs to a table. Remove 9 duplicate names from column A, paste the shorter list back, and every row below the first duplicate now sits next to someone else's phone number in column B. For a table, copy each row as one line (cells separated by tabs) so whole rows are compared and removed together, then paste the rows back.

Example: Checking a class roster before a field trip

  1. Two teachers each typed a list: 26 and 24 names, 50 lines in all
  2. After removing duplicates: 31 lines
  3. 50 − 31 = 19 names appeared on both lists

31 different students are going, so book seats for 31 plus the teachers.

If you need to keep the tab-separated layout, skip the extra-spaces cleaner for this job, since it turns tabs into spaces. Trimming each line here only touches the ends of a row, so the tabs between cells survive.

Fair raffles and random draws

Before a prize draw, remove duplicates so nobody who entered twice gets double the chance. Because the first occurrence stays in its original place, the cleaned list still shows entries in the order they arrived, which helps if the rules reward early entries.

Then hand the cleaned list to the Name Picker to draw a winner, or to the List Shuffler to set a random order for presentations or turns.

Sources and further reading

How to use it

  1. 1Paste your list, one item per line.
  2. 2Choose whether case and spaces matter.
  3. 3Copy the cleaned list.

Questions

Is the original order kept?

Yes. The first time each line appears is kept in place; later copies are removed.

Is my text uploaded anywhere?

No. Everything happens in your browser; your text never leaves your device.

Also handy: Random Name Picker, Text to QR Code, Shuffle a List