Skip to main content

Remove Duplicate Lines

Remove duplicate lines from your text and keep only unique entries.

Built and tested by Muhammad Irfan Liaqat · Updated

Remove Duplicate Lines: key facts

  • Removes repeated lines and keeps the first occurrence of each, in the original order
  • Options: case sensitive matching and trimming spaces at the start and end of lines (both on by default)
  • Blank lines are kept, and the result shows how many duplicates were removed
  • Compares whole lines; it does not sort the list or remove duplicate words within a line

How duplicate lines are detected

Paste a list and this tool removes every line that repeats an earlier one, keeping the first occurrence in its original position. The cleaned list updates as you type and shows how many duplicates were removed, ready to copy into a spreadsheet, email tool or code.

Two options decide what counts as a duplicate. Case sensitive, on by default, treats “Apple” and “apple” as different lines; turn it off to merge them. Trim whitespace, also on by default, ignores spaces at the start and end of each line, so “apple ” and “apple” match. Blank lines are left where they are, and the order of the list is never changed, so sort it in a spreadsheet first if you need alphabetical output.

How to remove duplicate lines from a list

  1. 1Paste your list into the box, one item per line
  2. 2Choose whether matching is case sensitive and whether to trim spaces
  3. 3Check the result and the number of duplicates removed
  4. 4Click Copy to copy the cleaned list

Frequently Asked Questions

Does it keep the original order?
Yes. The first time a line appears it stays in place; later copies are removed. Nothing is sorted or moved.
Is the comparison case sensitive?
By default, yes: “Hello” and “hello” are kept as two lines. Untick Case sensitive to treat them as duplicates.
Does it remove blank lines?
No. Empty lines are kept, so the shape of your text stays the same. Delete them by hand if you need a list without gaps.
Can I clean an email list with it?
Yes. Paste one address per line and turn off Case sensitive, because email addresses are almost always treated as case-insensitive. Leave Trim whitespace on so stray spaces do not hide duplicates.
Is there a limit on the number of lines?
There is no set limit. The work happens in your browser, so very long lists are limited only by your device's memory.
Does it keep the first or the last copy of a duplicate?
The first. Later copies are removed and the remaining lines stay in their original order.
How do I remove duplicates from an Excel or Google Sheets column?
Copy the column, paste it here, then copy the result back. Inside the spreadsheet, Excel has Data > Remove Duplicates and Google Sheets has Data > Data cleanup > Remove duplicates.
Can it remove duplicate words instead of duplicate lines?
Not directly, because it compares whole lines. Put each word on its own line first, for example with find and replace, and the duplicates can then be removed.
Can it sort the list as well?
No. The tool keeps your original order. Sort the list in a spreadsheet or text editor before or after removing duplicates.

Related Tools

Guides