How to Remove Blank Lines
Text copied from PDFs, emails and web pages often arrives full of gaps. Removing blank lines makes lists usable again and tidies documents — and you can keep single breaks between paragraphs.
Open Remove Blank LinesStep by step
Open Remove Blank Lines
Remove Blank Lines removes lines that are empty or contain only spaces and tabs.
Add your text
Paste it in, or upload a file.
Choose what to remove
“All blank lines” removes every gap. “Keep single spacing” collapses runs of blank lines into one, so paragraphs stay separated. “Only at start & end” trims the edges and leaves the middle alone.
Run it and save the result
Press Remove blank lines, then copy or download the result.
Example
First paragraph Second paragraph Third
First paragraph Second paragraph Third
“All blank lines” mode — the line containing only spaces is removed too.
Blank vs. empty lines
An empty line has nothing on it. A blank line looks empty but may contain spaces or tabs, which many tools don’t treat as empty. If a “remove empty lines” feature seems to miss some gaps, they are probably blank lines.
In Microsoft Word
Open Replace (Ctrl H), search for ^p^p and replace it with ^p, then press Replace All until no more replacements are made. This only handles truly empty paragraphs.
In VS Code or another editor with regex
Open Find and Replace, enable regular expressions, search for the pattern below and replace it with nothing.
^\s*$\nOn the command line
grep can print only the lines that contain at least one non-space character.
grep -v '^[[:space:]]*$' input.txt > output.txtTry Remove Blank Lines
Remove empty lines and lines that only contain spaces or tabs.
Frequently asked questions
Will this change the text on my non-blank lines?
No. Only lines that are empty or contain nothing but whitespace are removed.
How do I also fix spaces inside lines?
Run Remove Extra Spaces or Text Cleaner on the result.

