Remove Duplicate Lines

Delete repeated lines and keep the first of each.

Result

banana
Apple
cherry
apple
Banana
date
Elderberry
fig
8 lines · 52 bytes
  • 1 duplicate line removed, 8 kept. The first occurrence stays, in its original position.

What does removing duplicate lines do?

It scans a list from top to bottom and drops any line that has already appeared, keeping the first occurrence in its original place. The order of what remains does not change, so the result is the same list without repeats.

You decide what counts as a duplicate. By default lines must match exactly, so Apple and apple are different. Turn on "Ignore case" and they match. Turn on "Ignore spaces around lines" and "apple " with a trailing space matches "apple". The tool reports how many duplicates were removed and how many lines were kept.

How to use the Remove Duplicate Lines

  1. Paste your list, one item per line.
  2. Choose whether case should matter.
  3. Choose whether to ignore spaces around lines.
  4. Copy the cleaned list and read the count.

Real situations

When people use the Remove Duplicate Lines

  • 1

    Clean a mailing or contact list

    Remove repeated names or email addresses that were copied into one list from several different sources.

  • 2

    Tidy a keyword or tag list

    Merge lists of keywords or tags from different places into one clean set of unique words.

  • 3

    Shrink a log or export

    Drop repeated lines from a log or export so that you can see each distinct message just once.

  • 4

    Prepare data before import

    Remove duplicate rows from a plain text list before loading it into a system that rejects repeats.

FAQ

Remove Duplicate Lines: questions answered

Which copy of a duplicate is kept?

The first. Later copies are removed, and the lines that remain keep their original order. If you want a sorted list as well, sort the result afterwards.

What does the sample show?

The sample has nine fruit lines. With exact matching, only one duplicate is removed (the second apple), leaving eight. With "Ignore case" on, apple, Apple, banana and Banana collapse together, so 3 duplicates are removed and 6 lines are kept.

Does case matter?

By default, yes: Apple and apple are different lines. Set Letter case to "Ignore case" if they should be treated as the same item.

How do I handle trailing spaces?

Choose to ignore spaces around lines. Otherwise "apple" and "apple " are different because of the extra space. This often explains why a list seems to still contain duplicates.

Does it sort the list?

No. It keeps the original order. To sort as well, use the sort lines tool on the result.

Does it remove blank lines?

Repeated blank lines count as duplicates, so only the first blank line remains. To remove all empty lines, use the remove empty lines tool.

Is this Remove Duplicate Lines free and private?

Yes. It is free with no sign-in, and every calculation runs inside your browser. Nothing you type is sent to a server or stored, and the page keeps working offline once it has loaded.

Private by design. No accounts, no cookies, no tracking. Everything you type stays on your device.

How we keep it that way