Remove empty lines from text

Paste your text and remove the blank lines. Remove all of them, collapse the extra ones between paragraphs, or clear only the empty lines at the start and end.

  • Free
  • No sign-up
  • Runs in your browser
remove-empty-lines

100% private — your text is processed in your browser and never sent to any server.

How it works

Paste your text

From a document, an email, a web page, a PDF or a file.

Choose what to remove

All blank lines, the extra ones, or only those at the start and end.

Copy the result

Paste it wherever you need it.

Getting rid of blank lines the right way

Blank lines pile up in copied text: a web page pasted with a gap between every paragraph, a PDF that adds an empty line after each sentence, a list exported with spacing between items or a file where every line is followed by an empty one. Removing them by hand is slow and error-prone. This tool does it in one step, and it lets you decide how much to remove, because the right answer depends on the text.

Three ways to clean blank lines

  • All blank lines: every empty line disappears and the text becomes one continuous block of lines. It is the best option for lists, code, data and logs.
  • Extra blank lines: several empty lines in a row are reduced to a single one. Paragraphs stay separated but the large gaps disappear. It is the right option for articles and emails.
  • Only at the start and end: empty lines before the first line of text and after the last one are removed, and everything in between stays as it is.

Lines that look empty but are not

The most common reason a clean-up seems to fail is that some "empty" lines contain spaces or tabs, so they are not really empty. By default the tool treats a line with only whitespace as blank, so those are removed too. If you turn the option off, only lines with no characters at all are removed. You can also trim the spaces at the edges of the remaining lines.

Joining lines is a different problem

Removing blank lines does not join lines that were broken in the middle of a sentence, which is what many PDFs do. For that, use the text cleaner, which has an option to rejoin broken lines and to remove hidden characters as well.

What it does not do

The tool works line by line and does not understand paragraphs or sentences. A blank line inside a code block, a poem or a table is removed just like any other if you choose to remove all of them.

Frequently asked questions

How do I remove all the blank lines from a text?
Paste it, leave "All blank lines" selected and copy the result.
How do I keep one blank line between paragraphs?
Choose "Extra blank lines". Several empty lines in a row are reduced to one, so paragraphs stay separated.
Why are some lines still blank after cleaning?
They probably contain spaces or tabs. Keep "Count lines with only spaces as blank" ticked so they are removed too.
Can I remove only the blank lines at the beginning and end?
Yes. Choose "Only blank lines at the start and the end". The text in between is left untouched.
Does it join lines that were split in the middle of a sentence?
No. For that, use the text cleaner, which can rejoin broken lines from PDFs.
Is my text uploaded anywhere?
No. It is processed in your browser.