🧹

Remove Duplicate Lines

Strip duplicate lines from any list or block of text, with optional case-insensitive matching. Instant, private, and handles large lists.

✓ Free forever✓ No signup✓ 100% private — runs in your browser
Remove Duplicate Lines
Remove duplicate lines from any text. Options for case sensitivity, trimming whitespace, and sorting output.
Input (one item per line)
Output

Duplicate entries creep into any list that has been merged, exported, or copied together from several places — email lists, keyword sets, ID exports, log lines. Removing them by hand is impractical beyond a few dozen rows.

How to use the Remove Duplicate Lines

  1. Paste your list, one entry per line
  2. Choose whether matching should ignore case
  3. Click to remove duplicates
  4. Copy the deduplicated list

Case sensitivity changes the answer

With case-sensitive matching, Apple and apple are different lines and both survive. With case-insensitive matching, the second is removed and the first is kept.

Which you want depends entirely on the data. Email addresses are case-insensitive in practice, so deduplicate them ignoring case. Passwords, API keys, hashes and Base64 values are case-sensitive and must be deduplicated exactly — treating them loosely will silently destroy valid entries.

What gets kept

The first occurrence of each line is kept and later repeats are dropped, so the original ordering of the surviving lines is preserved. That matters when the list is in a meaningful order — by priority, by date, or by relevance.

Note that lines differing only by trailing whitespace are not duplicates as far as a literal comparison is concerned. If a list looks like it should deduplicate further than it does, invisible trailing spaces are almost always the reason.

Cleaning the list before deduplicating it

Deduplication matches strings exactly, so anything that makes two visually identical lines differ as text will defeat it. In real exports, that is most of the problem.

  • Trailing spaces. The most common cause by far, and invisible. Spreadsheet exports produce them constantly.
  • Non-breaking spaces. Text copied from a web page or a Word document often contains U+00A0 where a normal space appears. It looks identical and is a different character.
  • Curly versus straight quotes. O'Brien and O'Brien are different strings depending on which apostrophe each came from.
  • Line endings. A file from Windows carries a carriage return at the end of every line; pasted into text from another system, half your lines have an invisible extra character.
  • Zero-width characters. Rare but real, usually from copy-pasting out of rendered HTML.

A reliable order: sort first so near-identical lines sit adjacent and become visible, then deduplicate. If entries that clearly should match survive, the difference is whitespace or encoding, not logic.

When duplicates should be counted rather than removed

Removing duplicates discards information — specifically, how many times each entry appeared. That is often the thing you actually wanted.

If you are deduplicating a list of search terms, error messages, survey answers or support ticket subjects, the frequency is the finding. The entry appearing 400 times is the one worth acting on, and a deduplicated list makes it look exactly as important as the one appearing once.

So before removing, ask whether the duplicates are noise or signal. Merged mailing lists, exported IDs and keyword sets are noise: a duplicate is an accident of how the list was assembled. Logs, queries and free-text responses are signal: a duplicate is a real repeated occurrence.

Where frequency matters, sort first and count the runs, or paste into a spreadsheet and use a pivot. Deduplicate only once you have the counts you need — the operation cannot be undone from its own output.

Deduplicating across two lists rather than within one

A related job comes up often: not removing duplicates inside one list, but comparing two — which entries are in both, which only in the first, which only in the second.

With a deduplicator and a sorter this is still workable. To find entries in both, concatenate the two lists and look for lines that appear twice — sorting first makes the pairs adjacent and visible. To find entries unique to one list, the simplest reliable route is a spreadsheet, where a lookup against the other column answers it directly.

The usual real cases are a mailing list against an existing-customer list, a keyword set against pages you already have, or a new export against yesterday's.

Whichever method you use, normalise both lists first. Trim whitespace, settle on one case, and make sure line endings match. Two lists from different systems almost never agree on these, and every mismatch shows up as a false difference — which is the single most common reason this kind of comparison produces nonsense.

Frequently asked questions

Which duplicate is kept — the first or the last?

The first. Later repeats are removed, so the relative order of the remaining lines is unchanged.

Does it sort the list as well?

No, order is preserved. If you want the result sorted, run it through the Sort Lines tool afterwards.

Can it handle very large lists?

Yes — deduplication uses a hash set, so it handles tens of thousands of lines quickly. The practical limit is the browser's memory, not the algorithm.

Why are two lines that look identical not being removed?

Almost always trailing whitespace, or a non-breaking space pasted from a web page or Word document. Both are invisible but make the lines genuinely different.