Remove Empty Lines in One Step
This tool deletes blank lines and keeps every other line as it is. For example:
First line
Second line
Third linebecomes:
First line
Second line
Third lineThe 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:
Shopping list
apples
bread
milk
Notes
call the shop before noonNote 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:
Paragraph one.
Paragraph two.
Paragraph three.becomes:
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:
^\s*$\nOn 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.
Related Clean Up Tools
- Remove Duplicate Lines deletes repeated lines.
- Sort Lines puts a list in order.
- Space Remover fixes double spaces inside lines.
- Shuffle Lines puts a list in random order.
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.