Skip to content

How to remove duplicates in Notepad++?

  • by
  • 3 min read

As versatile as Notepad on Windows is, it doesn’t do much other than open just about any text or code file. Sure, you can quickly edit or write a new file, but the feature set is quite limited if you want to do anything beyond that, and that’s where editors like Notepad++ come into the picture.

Notepad++ is a lightweight and powerful code and text editor jam-packed with customisations and features that’ll make your life easier. From removing duplicates to managing fonts for individual programming languages, Notepad++ does it all.

In this article, we’re looking at how you can remove duplicate lines in Notepad++. You can watch the video below or continue reading the article.

Also read: How to download and install Notepad++?

Removing duplicates in Notepad++

When removing duplicate lines in Notepad++, you can either use the line operation options provided in the editor or regular expressions via the find and replace option.

Removing duplicates using Line Operations

Follow these steps to remove any duplicates using the line operations provided in Notepad++

Step 1: Open your file in Notepad++, go to the Edit menu, and then hover over the Line Operations option.

Step 2: You’ll find two operations to remove duplicates here:

  • Remove Duplicate Lines: Remove all duplicate lines except the first instance from the document.
  • Remove Consecutive Duplicate Lines: Remove all consecutive duplicate lines from the document. Any duplicate instances that don’t have an identical next line are left in place.

Select the option that best suits your needs, and all duplicate lines will be removed accordingly.

Removing duplicates using regex

One of the many advanced features of Notepad++ is support for regex queries (regular expressions) in the Find and Replace option. This allows you to delete duplicate lines based on a specific word or any instance of your choice. For example, the following regex query will find every duplicate line:


The aforementioned regular expression will find all duplicate lines. You can then type in $1 In the replace section, click Replace All to remove all duplicates. You can launch the Replace tool in Notepad++ using the Ctrl + H keyboard shortcut or by heading to the Search menu and clicking Replace.

Also read: How to wrap text in Notepad++?

Yadullah Abidi

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: