Remove Duplicate Lines

Remove duplicate lines from a list while keeping the first occurrence and the original order. Optional case-insensitive matching, trimming and sorting, all in your browser.

-

How it works

The first time each line appears it is kept; every later repeat is removed, so the original order is preserved. By default capitals are ignored (so “Apple” and “apple” count as the same) and surrounding spaces are trimmed before comparing, both are toggleable.

Your list stays in your browser, nothing is uploaded.

What this does

This tool removes duplicate lines from a list, keeping the first occurrence and the original order.

How to use it

  1. Paste your list.
  2. Choose case-sensitive matching or not.
  3. Optionally trim or sort.
  4. Copy the de-duplicated list.

How it works

The first time a line appears it is kept; every later repeat is removed. By default matching is case-insensitive, so “Apple” and “apple” count as the same line.

Understanding your result

The result keeps the first time each line appears and drops every later repeat, so the original order is preserved rather than sorted. Matching is case-insensitive by default, so Apple and apple collapse into one, turn that off if case matters. Whitespace counts too: two lines that look identical but differ by a trailing space are treated as different, so trim first if that is not what you intend.

Example

From “a, b, a, c” the result is “a, b, c”.

Sources & methodology

Last updated .

Frequently asked questions

Which copy of a duplicate is kept?

The first time a line appears it is kept; every later repeat is removed, so the original order is preserved.

Does capitalisation matter?

By default no, “Apple” and “apple” are treated as the same. Turn on case-sensitivity to keep them separate.

Is my list private?

Yes. Lines are compared in your browser; nothing is uploaded or stored.