Remove Empty Lines
Remove all blank lines from your text in one click.
Which lines count as empty
A line is removed when it has nothing on it but whitespace. That includes:
- truly empty lines;
- lines that contain only spaces;
- lines that contain only tabs;
- lines that contain only non-breaking spaces, which often come in when you copy from a web page or a Word document.
Every other line is kept exactly as it was. The tool does not trim the lines it keeps, so indentation at the start of a line and stray spaces at the end stay in place. That matters for code and for nested lists, where the indentation carries meaning.
A worked example
This input has an empty line, a line of three spaces, a line with a single tab, and two blank lines at the end:
The output is just the three lines of text, with no blank line left at the end:
Because a final line break counts as one more empty line, the result never ends with a trailing newline. If the program you paste into expects one, add it yourself.
All blank lines go, including paragraph breaks
There is no setting to keep one blank line between paragraphs. If you paste an article, every paragraph ends up directly under the one before it. Good uses are:
- lists exported from a spreadsheet or form with empty rows between entries;
- text copied out of a PDF, which often adds a blank line after every line;
- CSV or config files where an empty line would be read as an empty record;
- code pasted from a chat or email that came out double-spaced.
If you only want to get rid of repeated blank lines and keep a single gap, Remove Duplicate Lines does something close: it keeps the first blank line and removes the rest, although it also removes any other line that appears twice.
Windows and Mac line endings
Text saved on Windows uses a carriage return plus a line feed at the end of each line. You don't need to convert it. When you paste into the box, the browser stores every line break as a single line feed, so a file from Notepad is handled the same way as one from a Mac. The copied result uses plain line feeds, which modern editors on every system read correctly.
Frequently asked questions
Why does a line that looks empty stay in the output?+
It contains a character that is not whitespace, often a zero-width space or another invisible formatting character picked up when copying from a web page or messaging app. Delete that line by hand, or retype it.
Will it change the spacing inside my lines?+
No. Only whole lines are removed. Double spaces, tabs and indentation on the lines that remain are left alone. To tidy those, run the text through Remove Extra Spaces afterwards.
Can I remove blank lines from code safely?+
The code will still have the same lines in the same order, so it will usually behave the same. The exceptions are formats where an empty line has meaning, such as Markdown paragraphs, Python docstrings and email headers, so check those before you paste the result back.
Embed this tool on your website
Free to use on blogs, school sites and intranets. Paste this code into your page's HTML; please keep the credit line.
<iframe src="https://utilityapp.lat/embed/text/remove-empty-lines" title="Remove Empty Lines" width="100%" height="600" style="border:0;max-width:760px" loading="lazy"></iframe> <p style="font-size:13px"><a href="https://utilityapp.lat/text/remove-empty-lines">Remove Empty Lines</a> by UtilityApp</p>