How to remove duplicate lines from a list without losing its order
Paste a list, see how many lines repeat, and delete the copies while everything else stays where it was.
Merged two exports and now the email list has 1,400 rows where it should have 900. The Remove Duplicate Lines tool strips the repeats, tells you how many it dropped, and leaves the surviving lines in the order you pasted them.
How it works
- Paste your list into the top box, one item per line.
- Leave the mode on Keep first copy, or switch to one of the other three depending on what you are after.
- Read the summary line, which spells out how many duplicates went and how many lines survived, then copy the result.
Four modes, four different questions
Keep first copy is the ordinary dedupe. Each line stays at the position where it first appeared and every later repeat disappears. Keep last copy does the reverse and holds each line at its final position, which is what you want when later rows in an export are the fresher ones.
Only duplicates flips the output. Instead of the cleaned list you get one copy of every line that shows up two or more times, which is how you audit an import before you commit to deleting anything. Only unique lines is the mirror of that: the lines that appear exactly once and nowhere else. That differs from Keep first copy, which still hands you one of every repeat. A line appearing three times survives the dedupe once and vanishes entirely from unique mode.
The invisible reason two identical lines do not match
Deduplication is an exact string comparison, and "apple " with a trailing space is not "apple". Copy a column out of a spreadsheet or a PDF and you will pick up trailing spaces, non-breaking spaces and stray tabs you cannot see in a textarea.
Trim whitespace before comparing is on by default for that reason. It strips leading and trailing whitespace from the comparison key only. The line that survives keeps its original spacing, so nothing gets silently reformatted behind your back. Case-sensitive is off by default, so Apple and apple count as one item. Turn it on when the list holds identifiers, API keys or anything where capitalisation carries meaning.
What this will not catch
Near-duplicates stay put. "John Smith" and "john smith" with two spaces are different strings, and no toggle here collapses internal whitespace. Same for "Ltd" against "Ltd." or an email with a plus-tag against the one without. For that kind of cleanup you want a fuzzy match, and it is worth doing by eye at the row level rather than in bulk.