Remove Empty Lines

Paste text full of gaps. Remove them all for a tight list, or keep one blank line between paragraphs so the text still reads as prose.

How it works

A line counts as empty when it has nothing on it, or only spaces, tabs and other blank characters. Those lines look empty on screen, so they are treated as empty here too.

Remove them all deletes every empty line, so a list ends up with one item per line and no gaps. Keep one between paragraphs turns any run of empty lines into a single one, and takes the empty lines off the start and the end.

The lines with text on them are not changed at all, and their line breaks stay as they were, so a Windows file keeps its Windows line breaks. Everything runs on this page.

How to use it

  1. 1 Paste your text into the Text box.
  2. 2 Choose Remove them all, or Keep one between paragraphs.
  3. 3 Check the count below the result to see how many empty lines went.
  4. 4 Copy the result, or download it as a .txt file.

Good to know

  • Text copied from a PDF or an email often has an empty line after every line. Remove them all fixes a list; for prose, keep one between paragraphs.
  • A spreadsheet ignores nothing: an empty line pasted into a column becomes an empty cell. Remove the gaps first.
  • If you also want stray spaces gone, Remove Extra Spaces or Text Cleaner can do both.
  • An empty line in the middle of a code block can matter. Check the result before you paste code back.

Browser support

  • Chrome 94 and later
  • Firefox 93 and later
  • Safari 16.4 and later
  • Edge 94 and later

These are the oldest versions with everything the tool uses. They are worked out from the tool itself, so they change when it does.

Version numbers checked on 2026-09-04.

Fixing text that comes out of a PDF with a blank line after every line

Copy a few paragraphs out of a PDF, paste them into an email, and you often get a mess: every line of the original page is now its own line, and many have an empty line after them. A ten-line paragraph turns into twenty lines with gaps. The words are all there. The structure around them is broken.

Paste that text here and choose Keep one between paragraphs. Every run of empty lines becomes exactly one, and empty lines at the very start or end go. If the PDF had one gap between lines and two or more between paragraphs, you now have one gap everywhere, which is easier to fix by eye. If it had gaps only between paragraphs, the result is already clean.

For a list the right choice is Remove them all. Say you copied 60 product codes from a web page and got them with an empty line between each one, 119 lines in total. Remove them all gives you 60 lines with nothing in between, ready to paste into a spreadsheet column, and the note under the result says "Removed 59 empty lines: 119 lines down to 60". That count is a quick check that nothing else was touched.

Lines that hold only spaces deserve a word. They look empty, and a spreadsheet or a script often treats them as data, which causes odd errors later: a cell that looks blank but is not, or a loop that runs one time too many. This tool counts a line with only spaces, tabs or no-break spaces as empty, so those go as well. In Keep one mode the blank line that stays has nothing on it at all.

The tool has limits worth knowing. It does not join the broken lines inside a paragraph back together; it only handles the empty ones. It also does not know that one empty line in a poem or in code can be deliberate, so check the result before you use it there. It changes nothing else on the lines that have text. It takes up to 1 MB of text at a time.

Frequently asked questions

Does a line with only spaces count as empty?

Yes. A line with only spaces, tabs or no-break spaces looks empty, so it is removed too. In Keep one mode the blank line that stays is truly empty, with no spaces on it.

Will this change the lines that have text?

No. Lines with text keep every character, including spaces at the start or end. Use Trim Whitespace for those.

What does Keep one between paragraphs do with empty lines at the top?

It removes them, and the ones at the bottom too. Between two paragraphs, any number of empty lines becomes exactly one.

Is there a limit on how much text I can paste?

Up to 1 MB at a time. The result updates as you type, and the limit keeps that quick on a phone.

Related tools

Your files are processed on your device and are not uploaded. You can verify this in your browser’s developer tools under the Network tab.