Skip to content
ToolPlankDEV
Text Tools
100% In-Browser Execution

Updated:

Remove Empty Lines from Text

Paste your text to remove empty lines in one step. Delete every blank line, or keep a single empty line between paragraphs. Lines that hold only spaces or tabs count as empty, and the count of removed lines shows under the result. Nothing is uploaded.

Options:

Your text

Input
0 chars · 0 lines

Text without empty lines

Ready
Processing in browser...
0 chars · 0 linesUpdates as you type

Processed on your device. Your text is not sent to our servers.

More free tools you may need next.

Quick Guide

How to use Remove Empty Lines

Simple step-by-step instructions to get the exact output you need.

  1. 01

    Paste your text

    Paste into the Your text box, press Paste to read your clipboard, or drop a .txt file onto it. Press Sample to load a short list with blank lines.

  2. 02

    Choose what to remove

    All empty lines deletes every blank line. Keep one between paragraphs leaves a single empty line where there was a run of them.

  3. 03

    Set the line options

    Spaces-only lines are empty is on by default. Trim line ends removes spaces and tabs at the end of each kept line.

  4. 04

    Copy the result

    The line under the result shows how many lines were removed. Press Copy, or Download to save a .txt file.

Remove Empty Lines in One Step

This tool deletes blank lines and keeps every other line as it is. For example:

Text
First line


Second line
   
Third line

becomes:

Text
First line
Second line
Third line

The line with three spaces counts as empty because Spaces-only lines are empty is on. Turn it off and that line stays, giving four lines instead of three. You can also delete blank lines online without any setting at all, because the defaults already do this.

Delete Blank Lines and See How Many Were Removed

Under the result the tool shows how many lines were removed. The Sample button loads a short shopping list that mixes empty lines, lines with spaces and a tab, and a line with spaces after the word. It has 15 lines. With the default settings 9 lines are removed and 6 are left:

Text
Shopping list
apples
bread
milk   
Notes
call the shop before noon

Note that milk still has three spaces after it. Those are not a line of their own, so they stay unless you switch on Trim line ends. With Trim line ends on, the same sample gives milk without the trailing spaces and still removes 9 lines. With Spaces-only lines are empty off, only the truly empty lines go: 7 lines are removed, and the lines that hold only spaces or a tab stay.

Keep One Blank Line Between Paragraphs

Set Remove to Keep one between paragraphs to tidy text without joining the paragraphs. Each run of blank lines becomes one empty line, and blank lines at the start and end are dropped:

Text
Paragraph one.



Paragraph two.


Paragraph three.

becomes:

Text
Paragraph one.

Paragraph two.

Paragraph three.

This mode is the better choice for articles, emails and notes, where a blank line marks a new paragraph. To join the lines inside each paragraph as well, use Remove Line Breaks.

Remove Empty Lines in Notepad++ or VS Code

In an editor, open Find and Replace, turn on regular expressions, search for the pattern below and replace it with nothing:

Text
^\s*$\n

On Windows files the line ending may be \r\n, so the pattern may need ^\s*$\r?\n. Be careful with this pattern: \s also matches line breaks, so on some editors it can swallow more than one blank line at once, and it needs a final line break to match the last blank line. This page does the same job without a pattern and shows the count of removed lines.

When Not to Remove Empty Lines

Blank lines are sometimes meaningful. In Markdown a blank line separates paragraphs and lists, in a poem it separates stanzas, and in a log or a CSV file it can mark where one record ends. Use Keep one between paragraphs for those. If you need to remove a blank row from a spreadsheet, delete the row in the spreadsheet itself, because this tool works on plain text lines only.

Line Endings, Limits and Privacy

Text pasted or uploaded on this page is changed to plain line feeds (LF) first, so Windows CRLF endings come out as LF. If a program needs CRLF, convert the result in your editor. The tool handles up to 2,000,000 characters. Your text stays in your browser and is not uploaded. See the Privacy Policy.

Frequently Asked Questions

Technical Q&A for Remove Empty Lines

Common questions about edge cases, character encoding, and privacy guarantees.

Paste the text and leave Remove set to All empty lines. Every blank line is deleted and the result is ready to copy.

Set Remove to Keep one between paragraphs. Runs of blank lines become a single empty line.

Yes, by default. Lines with only spaces, tabs or other blank characters are removed. Turn off Spaces-only lines are empty to keep them.

Use Find and Replace with regular expressions on, search for ^\s*$\n and replace with nothing. Or paste the text here and copy the result back.

Yes. Text pasted or uploaded here is turned into LF line endings before it is processed, so the result uses LF.

An empty line has no characters. A blank line may hold spaces or tabs. By default this tool removes both.

Only if you switch on Trim line ends. It removes spaces and tabs at the end of every kept line and does not touch the start.

Yes. The count appears under the result after each change.

No. The text is processed in your browser and stays on your device.