Skip to content

Remove Duplicate Lines

Remove repeated lines from a list and keep the first copy of each, in the original order.

Duplicate line remover
One item per line. The first copy of each line stays.

Result
Unique lines
apple
banana
cherry
Banana
4
Lines kept
3
Lines removed

Private: Everything runs in this page. Nothing you type is sent anywhere or saved.

On this page
  1. Duplicate removal examples
  2. Formula
  3. How the duplicate line remover works
  4. What this tool does not do
  5. Frequently asked questions
  6. Related tools

Duplicate removal examples

Input linesLines kept
a, b, a, c3
x, x, x1
one, two, three3
Red, red, RED (case ignored)1
a, empty line, a1

Formula

keep a line only if it has not appeared above it

How the duplicate line remover works

  1. Step onePaste your list with one item on each line.
  2. Step twoChoose whether upper and lower case count as different, and whether to trim spaces and drop empty lines.
  3. Step threeCopy the unique lines. The tiles show how many lines were kept and removed.

What this tool does not do

  • It compares whole lines only, so two lines that differ by one character are both kept.
  • It does not sort the lines; the first copy of each stays where it was.
  • It does not find similar lines or fix typos.

Frequently asked questions

Which copy is kept?

The first one. Later copies are removed and the order of the remaining lines does not change.

Does it sort my lines?

No. Use the sort tool if you also want them in alphabetical order.

Is there a size limit?

There is no fixed limit, but very long lists use your browser's memory, so lists of a few hundred thousand lines may be slow on a phone.