Guides › How to Remove Duplicate Lines from a List (Excel, Sheets, Notepad and Online)

How to Remove Duplicate Lines from a List (Excel, Sheets, Notepad and Online)

Duplicate lines creep into every list: exports from two systems, merged mailing lists, keyword research, logs. Here is how to remove them in the places you probably already work, and how to get more than a simple “delete repeats”.

What “duplicate” really means

Before you remove anything, decide how strict matching should be. Is “Apple” the same as “apple”? Is “Apple ” with a trailing space the same as “Apple”? Most tools treat those as different unless told otherwise, which is why a list can still look full of duplicates after cleaning. Trimming spaces and ignoring case catches most of them.

Excel

Google Sheets

Notepad++

Recent versions have Edit then Line Operations then Remove Duplicate Lines. Older versions only removed consecutive duplicates, so sort the lines first.

The command line

On macOS or Linux, to keep the original order and the first copy of each line:

awk '!seen[$0]++' input.txt > output.txt

Or sort and remove in one step with sort -u input.txt. In Windows PowerShell:

Get-Content input.txt | Select-Object -Unique | Set-Content output.txt

That keeps the first occurrence and treats different capitalisation as different lines.

Online, without a spreadsheet

If the list is in a text file, an email, or a web page, the quickest way is to paste it into Remove Duplicates. Choose whether to ignore case, and the cleaned list appears as you type, with a count of how many lines were removed. Nothing is uploaded.

More than “delete the repeats”

Three different goals are easy to confuse:

The tool supports all three from one setting. For comparing two separate lists instead, see how to compare two columns.

Check your result

After deduplicating, compare the before and after counts. If almost nothing was removed from a list you expected to be full of repeats, the “duplicates” probably differ by spaces or capitals — turn on trimming and case-insensitive matching and run it again.

Try it now: use the free Remove Duplicates — private, instant and runs in your browser. Open Remove Duplicates →

More guides