How to Remove Duplicate Lines
To remove duplicate lines, paste the list into a duplicate line remover and run it. The first occurrence of each line is kept in its original position and later repeats are dropped. Decide first whether matching should ignore case and surrounding whitespace, because those two settings determine what counts as a duplicate at all.
Remove Duplicate Lines
Strip repeated lines from a list and keep the order.
De-duplicating a list sounds trivial until you look at what "the same" means. Are "Admin" and "admin" the same entry? Is a line with a trailing space the same as one without? Is a blank line a duplicate of another blank line?
Those answers change with the job. Email addresses are case-insensitive in practice, so ignoring case is usually right. A list of case-sensitive identifiers or passwords is the opposite. Trailing whitespace is almost always noise from copy-paste and worth ignoring.
Step by step
-
Paste the list
One entry per line. Lists copied out of spreadsheets, log files and email clients frequently arrive with trailing spaces or stray carriage returns, which the next two settings handle.
-
Decide on case sensitivity
Turn on case-insensitive matching for email addresses, domains and URLs, where case carries no meaning. Leave it off for identifiers, tokens and anything where Admin and admin are genuinely different.
-
Decide on whitespace
Ignoring leading and trailing whitespace catches duplicates that differ only by an invisible trailing space. This is nearly always what you want unless the spacing is meaningful, as it can be in indented data.
-
Run it and check the count
Compare the input and output line counts. A surprising drop usually means matching was looser than intended; almost no drop usually means it was stricter.
-
Switch to duplicates-only if you are auditing
The duplicates-only mode inverts the output and shows just the repeated entries. That is what you want when the question is "what was duplicated?" rather than "give me the clean list".
Example
Case-insensitive matching with whitespace ignored. Order is preserved and the first occurrence wins.
Input
ada@example.com
bob@example.com
ADA@example.com
bob@example.com
carol@example.com
Output
ada@example.com
bob@example.com
carol@example.com
Frequently asked questions
Is the original order preserved?
Which occurrence is kept?
Can I see only the duplicates?
Are blank lines treated as duplicates?
How large a list can I process?
Tools used in this guide
All tools →- Remove Duplicate Lines Strip repeated lines from a list and keep the order. In your browser
- Sort Lines Sort a list alphabetically, numerically, by length or at random. In your browser
- Line Counter Count total, non-empty and unique lines in any list. In your browser
- Text Cleaner Strip formatting, smart quotes and invisible characters. In your browser
- Find and Replace Replace text everywhere, with optional regex support. In your browser
Related guides
All guides →Last reviewed .