Text

Remove duplicate lines

The first copy of a line stays. Later copies are removed. Trim, case, and sort are optional.

The list stays in this browser. Nothing is uploaded.

How it works

The text is split on line breaks. A line is a duplicate when its key was already seen. With trim on, spaces at both ends are removed before the comparison, and the kept line is the trimmed one. With ignore case on, Apple and apple share a key, and the first spelling is the one that remains.

Sort runs after the duplicates are gone, using the browser’s alphabetical order. The original list is not changed until you copy the result. Nothing is uploaded.

Formula

  • Keep
    the first line for each key
  • Key
    trimmed line, optionally lowercased

Worked examples

Three spellings of one word

A, a, and A with ignore case on leave a single A. Two lines were duplicates of the first.

Spaces and order

“ A ” and “A” with trim and ignore case collapse to A. Sort then places the remaining lines in alphabetical order.

Options
OptionComparisonKept text
NoneExact lineFirst copy, spaces included
TrimEnds strippedTrimmed line
Ignore caseLowercase keyFirst spelling
SortAfter dedupingAlphabetical

Common questions

Is the list uploaded?

No. Duplicate removal runs in your browser.

Which copy survives?

The first one. Later lines with the same key are counted as removed.

Do blank lines count?

Yes. Two empty lines are duplicates. With trim on, a line of only spaces becomes empty and then matches other empty lines.

Does sort change meaning?

It only changes order. It does not merge different lines. Sort happens after duplicates are removed.