Duplicate Line Remover

0original lines
0unique lines
0duplicates removed
Dedupe methodOrder keptCase handlingWhen it wins
[...new Set(lines)]Original orderCase-sensitiveThe modern default - one line, O(n)
filter + indexOfOriginal orderCase-sensitiveReadable legacy code, no Set
Map countingOriginal orderYou normalize firstWhen you also need dup COUNTS
sort then dedupeSortedNormalize firstHuge lists where memory is tight
Reference: the MDN Set guide (Set keeps first-insertion order, which is why spread-dedupe does not scramble your list). Bottom line: dedupe AGAINST A NORMALIZED KEY but RETURN THE ORIGINALS - trim whitespace and lowercase for the comparison, keep the untouched line for the output, or 'Apple' and 'apple ' survive as false-unique. Counting duplicates first also tells you whether you have a data problem (one line 4,000 times) or just a messy paste.

Bottom line: deduplication is a set operation, which is why 10,000 lines answer instantly - each line is hashed into a set for constant-time lookup instead of comparing all pairs (which would be about 50 million comparisons). First occurrence wins, so the original order survives.

Paste a list — keywords, emails, log lines, CSV rows, URLs — and strip out every duplicate while keeping the first-seen order. Cleaned output appears instantly with a count of what was removed, and one click copies the result.

This is the everyday data-cleaning chore: deduplicating keyword exports before analysis, merging mailing lists, tidying SQL results, or trimming a wordlist. Everything runs locally in your browser — your data never touches a server, which matters when the list contains something private.

How to use

  1. Paste your text or list into the input box.
  2. The cleaned output appears instantly — duplicates removed, first-seen order kept.
  3. Check the removed-lines count, then hit Copy to take the result.

Frequently asked questions

How does it decide which duplicate to keep?

It keeps the first occurrence and drops every later repeat — so the order of your original list is preserved. This matters for ranked lists, logs and timelines.

Does it treat lines that differ only by spaces as duplicates?

Each line is compared exactly, including leading and trailing spaces. If your data has messy whitespace, trim the lines first — case is also preserved (Apple and apple are different).

Is there a size limit?

The practical limit is your browser tab's memory — lists of hundreds of thousands of lines process in a second or two. Everything runs locally, so there is no upload bottleneck.

Is my data uploaded anywhere?

No. The deduplication runs entirely in your browser with JavaScript. Nothing is transmitted or logged — you can disconnect from the internet and it still works.

Is the duplicate check case-sensitive?

Yes - Apple and apple are different lines, and so are item and item with a trailing space, because the comparison is exact bytes. If your list should be case-insensitive (email addresses, keyword exports), normalize first: convert everything to lowercase and trim whitespace, then dedupe. The one trap to know: invisible characters - a trailing tab or a non-breaking space - survive the visual check and defeat the dedupe, which is why pasted-from-Excel lists often keep 'duplicates' after cleaning.

How do I deduplicate lines while keeping the last occurrence instead of the first?

Standard Set-dedupe keeps the FIRST occurrence and drops later repeats. Keeping the LAST one is a two-pass: walk the list once to count occurrences of each normalized line, then walk again and keep a line only on its final appearance. The pattern matters for logs and merged exports, where the latest entry wins and the earlier ones are history. The counting pass doubles as your duplicate report - how many lines died, and which normalized keys had the most collisions.

Related tools