Removing empty lines in Notepad++ means stripping blank rows from a text file so the result is compact, readable, and free of accidental vertical gaps. The editor ships with three practical routes for this job: the Edit > Line Operations menu, the Find and Replace dialog with a regular expression, and the TextFX Characters plugin. Each one handles strictly empty lines and whitespace-only lines differently, which is why pasting the same snippet into each method can produce different output. Some remove only zero-length rows, while others interpret a line full of spaces or tabs as blank. This guide walks through all three Notepad++ approaches, then shows a browser-based alternative that performs the same clean-up without any plugins, regex, or saved files. The right choice depends on how much text you have, whether you need to keep indentation, and whether you trust yourself to type the regex without a typo.

Why Blank Lines Pile Up in Notepad++
Plain text copied from web pages, spreadsheets, PDFs, or log files usually carries extra line breaks that look fine in their original context but show up as awkward gaps in Notepad++. Common culprits include HTML rendered to text, CSV exports with trailing blank records, IDE snippets with collapsed method blocks, and chat transcripts where each message ends with two newlines. Editors also leave behind lines of pure indentation when you delete a line but not its leading whitespace. The result is the same regardless of cause: a file that scrolls further than it should, with vertical gaps that confuse readers and occasionally break parsers that treat blank lines as record separators.
Before choosing a removal method, decide whether a line full of spaces, tabs, or invisible characters counts as blank for your use case. Code that uses whitespace-only rows as visual separators in YAML, Python, or Markdown may lose meaning if those rows vanish. A list of email addresses exported from a spreadsheet probably should lose them. The same text, two different answers, and the difference sits entirely in that one toggle.
Remove Empty Lines in Notepad++ (Built-In Methods)
Notepad++ gives you three built-in paths to a blank-line-free file, and the right pick depends on whether you want a one-click menu action or the precision of a regular expression. All three are reversible with Ctrl+Z, so a misfire costs nothing more than a quick undo.
Method 1: Edit > Line Operations menu. Open the file, click Edit in the menu bar, hover over Line Operations, and pick one of two variants. Remove Empty Lines deletes only strictly empty rows. Remove Empty Lines (Containing Blank Characters) also drops rows that contain only spaces, tabs, or other invisible characters. Both actions run instantly on the active document, and neither requires typing a regex.
Method 2: Find and Replace with regex. Press Ctrl+H to open the dialog. Tick Regular expression in Search Mode at the bottom left. Set Find what to ^\s*\r?\n, leave Replace with empty, and click Replace All. The caret matches the start of a line, \s* matches zero or more whitespace characters, and \r?\n matches an optional carriage return followed by a line feed. This pattern removes zero-length lines and whitespace-only lines in one pass. A common mistake is leaving the \s* off, which leaves indented blank rows behind, or accidentally turning on . matches newline, which can balloon the replacement.
Method 3: TextFX Characters plugin. If TextFX is installed (it ships with many older Notepad++ builds), go to Plugins > TextFX Characters and choose Delete empty lines or Delete surplus blank lines. The plugin is no longer maintained in the latest releases, so newer installs may need to add it manually through the Plugin Manager or skip this option entirely.
| Method | Menu path | Treats whitespace-only as empty | Reversible | Plugin required |
|---|---|---|---|---|
| Line Operations (strict) | Edit > Line Operations > Remove Empty Lines | No | Yes (Ctrl+Z) | No |
| Line Operations (blank) | Edit > Line Operations > Remove Empty Lines (Containing Blank Characters) | Yes | Yes (Ctrl+Z) | No |
| Find and Replace regex | Ctrl+H, search mode = Regular expression, pattern ^\s*\r?\n | Yes | Yes (Ctrl+Z) | No |
| TextFX Characters | Plugins > TextFX Characters > Delete empty lines | Optional | Yes (Ctrl+Z) | Yes |
A Browser Alternative That Skips the Regex
Notepad++ is not always available: you may be on a borrowed machine, working from a Chromebook, or handling a file too large to open without lag. Typing a regex that could damage the file if you mistype the closing brace is also a real risk on production data. For those situations, the Remove Empty Lines tool runs entirely in the current tab. Paste the text, choose whether whitespace-only lines count as empty, click once, and the cleaned output appears with explicit counts of removed and retained lines. Nothing leaves the browser, no plugin is required, and no account is needed.
How to Use the Remove Empty Lines Tool
- Open the Remove Empty Lines tool in your browser.
- Paste the text containing blank rows into the input area, keeping the total length at or below one million UTF-16 code units.
- Decide whether whitespace-only rows count as empty. Leave the option enabled to catch lines full of spaces, tabs, or non-breaking spaces, or disable it so only strictly zero-length lines are removed.
- Click the process button and review the summary that reports how many lines were removed and how many were retained.
- Copy the cleaned text from the output area and paste it back into Notepad++ with Ctrl+V before saving over the original.
The summary line is the easiest way to confirm the clean-up matched your intent. A file that started with 250 input lines and shows 198 retained lines means 52 blank rows were removed, and you can cross-check that against a line counter if the file is still open in Notepad++. Always verify the result before saving over a production file, especially for programming languages where blank lines can aid readability even if they do not affect execution.
Whitespace-Only vs Strict Empty-Line Mode
The single toggle between them changes which rows leave and which stay. With whitespace-only mode enabled (the default), a line is removed when JavaScript's trim leaves it empty. That covers ordinary empty lines and rows containing only recognized whitespace such as spaces, tabs, non-breaking spaces, or other Unicode whitespace handled by the browser, as documented on the MDN String trim page. This is the right choice for pasted tables, Markdown drafts, subtitle fragments, email lists, configuration blocks, and logs where visual blank rows often hide invisible indentation left by editors or spreadsheets.
With strict empty-only mode, only a line with zero code units is removed. A line containing one space, one tab, or another whitespace character is retained exactly. This mode matters when indentation-only rows carry meaning in YAML, Makefiles, or Python, or when you want to keep a visible distinction between empty and whitespace-only records for a downstream diagnostic step. Retained lines are never trimmed in either mode. Leading indentation, trailing spaces, repeated internal spaces, punctuation, letter case, and Unicode characters all stay byte-for-byte unchanged. The tool does not collapse whitespace inside a line, wrap prose, remove duplicate content, sort records, or normalize Unicode. Its only decision is whether each complete line passes the selected blank-line predicate.
| Mode | Default state | Removes | Keeps | Best for |
|---|---|---|---|---|
| Whitespace-only | Enabled | Zero-length lines and lines whose Unicode trim is empty | Lines containing any non-whitespace character | Pasted tables, Markdown drafts, logs, copied web text |
| Strict empty only | Disabled | Zero-length lines only | Lines containing one or more whitespace characters | Source code with meaningful indentation-only rows |
Limits, Line Endings, and What the Tool Will Not Do
The input splitter recognizes CRLF, standalone CR, and LF, with CRLF counted as one boundary, as documented on the MDN String split page. Generated output always joins retained lines with LF, so a file mixing Windows and Unix line breaks leaves the browser in LF. A line ending at the end of the input creates a final empty line, which is then removed under either mode, and completely empty input is rejected before processing to avoid an ambiguous report that could otherwise call the absence of text one removable line.
Input is capped at one million UTF-16 code units for predictable browser memory and result rendering. Text at the exact limit is accepted. One additional code unit causes a visible error and no partial output, and the tool never samples, slices, or silently truncates a large input. Changing the input or the blank-line option clears the previous output and counts immediately. The implementation performs a single ordered pass after splitting: it evaluates the selected predicate for each line, appends retained values in original order, subtracts retained count from input count, and joins the result.
The tool does not parse CSV records with embedded newlines, quoted JSON strings, rich text, Word documents, or PDF layout. It sees a browser string and documented line boundaries only. Use the Remove Duplicate Lines tool for repeated values, the Line Break Remover to join lines with spaces or nothing, and a format-aware editor when line structure has syntax beyond plain text.