Remove Duplicate Lines

Remove repeated lines from a list while keeping the first copy or the last one. You can ignore case, trim lines before comparing, and drop empty lines at the same time.

Runs in your browser. Your data is not uploaded.
Updated

Your text

Settings

Updates as you type for smaller inputs.

Deduped lines

Deduped lines will appear here
  1. Paste lines, upload a file, or load a URL
  2. Choose keep first or last and any compare options
  3. Copy or download the cleaned list

How to use the Remove Duplicate Lines

  1. Paste your list or upload a text file.
  2. Choose whether to keep the first copy of a repeated line or the last one.
  3. Turn on Ignore case, Trim lines, or Remove empty lines if they match your data.
  4. Copy the cleaned list or download it after the duplicate lines are removed.

How it works

The text is split into lines. Each line gets a comparison key based on your options. If Trim lines is on, the key is built from the trimmed line. If Ignore case is on, the key is lower-cased before matching.

With Keep first, the tool keeps the first time it sees each key and skips later repeats. With Keep last, it reads from the bottom, keeps the last matching line, then puts the kept lines back in their original order.

Examples

  • For the lines b, a, b, c, the result is b, a, c.
  • With Ignore case on, Apple and apple count as the same line.
  • With Trim lines on, cat and cat match before the output is decided.

Limitations

  • Matching happens line by line only. Two repeated phrases inside one long line are not treated as duplicates.
  • If you turn on Trim lines, matching ignores spaces at the ends, but the kept output line still comes from the original text.
  • Blank lines count as lines unless Remove empty lines is turned on.
  • Text files up to 10 MB are supported.

Frequently asked questions

Should I keep the first or last duplicate line?

Keep first when the earliest copy is the one you trust. Keep last when later lines contain the version you want to preserve.

Does it sort the lines too?

No. This tool removes repeats and keeps the original order of the kept lines. If you also want sorting, use Line Sorter after deduping.

Can I remove empty lines at the same time?

Yes. Turn on Remove empty lines and they are left out before the cleaned text is built.

Often used together with the Remove Duplicate Lines.

  • Line Sorter

    Sorts lines A to Z, Z to A, naturally, numerically, by length, or randomly.

  • Whitespace Remover

    Cleans text by trimming, collapsing, joining, or removing whitespace.