Notepad++ tips and tutorials
Notepad++ can do more than open and save a text file. These 10 tutorials cover the tasks that come up most often: removing duplicate lines, comparing files, auto-completing HTML tags, batch-editing with regex, and more.
What is Notepad++?
Notepad++ is a free text and code editor for Windows.
Remove duplicate lines in Notepad++
This works on any file type: TXT, HTML, XML, and more.
- Click Edit in the top menu.
- Go to Line Operations.
-
Click Remove Duplicate Lines.

Compare files in Notepad++
- Click Plugins in the top menu.
- Click Plugins Admin.
- Type compare in the search field.
- Select the Compare plugin.
-
Click Install.

- Click Yes.
- Wait for Notepad++ to restart. Then open the two files you want to compare.
- Click Plugins in the top menu.
-
Go to Compare and then click Compare.

View files side by side in Notepad++
Method 1
- Right-click on the tab of a file.
- Go to Move Document.
-
Click Move to Other View.

Method 2
- Click View in the top menu.
- Go to Move/Clone Current Document.
-
Click Move to Other View.

Open a file in a new window in Notepad++
Method 1
- Right-click on the tab of the file.
- Go to Move Document.
-
Click Open in New Instance.

Method 2
- Click View in the top menu.
- Go to Move/Clone Current Document.
-
Click Open in New Instance.

Remove plugins from Notepad++
- Click Plugins in the top menu.
-
Click Plugins Admin.

- Click Installed.
- Select the plugin you want to remove.
-
Click Remove.

- Click Yes.
Add a word to the beginning or end of each line in Notepad++
- Press Ctrl + H to open the "Replace" window.
- Choose Regular expression at the bottom of the window.
- Type ^ in the Find what field to add the word to the start of each line. Type $ in the Find what field to add it to the end.
- Type the word in the Replace with field. Add a space after or before your word if you want it separated from the existing text.
- Click anywhere in the file first.
-
Click the Replace All button.

View how many files are open in Notepad++
- Click Window in the top menu.
- Click Windows.
-
The count appears at the top of the list.

Remove empty lines in Notepad++
- Click Edit in the top menu.
- Go to Line Operations.
-
Click Remove Empty Lines.

Duplicate a value into a new field in all open files in Notepad++
Use Replace with a regular expression to copy the value from title: into a new h1: line (or description: into intro:) across every open file at once. Files that already have the new field are skipped automatically. This example uses Hugo frontmatter (the metadata block at the top of a content file), but the same trick works for any repeated text pattern: CSV headers, config keys, log lines, whatever you need to duplicate across files.
- Make sure all the files you want to edit are open in Notepad++.
- Press Ctrl + H to open the Replace window.
- Choose Regular expression at the bottom of the window. This lets you use special patterns to match and copy parts of a line.
-
In the Find what field, type:
(?m)^(title:\s*(.*))$(?!\r?\nh1:)
This matches the title: line, grabs its value, and skips the file if h1: already sits on the next line.
-
In the Replace with field, type:
$1\r\nh1: $2
$1 is the original title: line. $2 is just the value after title:. \r\n adds a new line between them.
- Click Replace All in All Opened Documents.

The title: → h1: run above is one example. The same structure works for any field. To copy description: into intro: instead, use:
- Find what:
(?m)^(description:\s*(.*))$(?!\r?\nintro:) - Replace with:
$1\r\nintro: $2
To confirm which files already had the field before you ran the search and replace, press Ctrl + Shift + F to open "Find in Files", type (?m)^h1: in Find what, and click Find All. The results panel lists every file that already contained h1:.
