Free online text tool

Remove Empty Lines

Remove Empty Lines deletes the empty lines and the lines that only contain spaces from your text. Paste your text, click the button and copy the result. It is free and runs in your browser.

Remove Empty Lines Tool

0Character Count
0Character Count (without spaces)
0Word Count
0Sentence Count
0Paragraph Count
0Line Count

Empty Line Removal Example

Before
Random words in front of other random words create a random sentence.

Random words in front of other random words create a random sentence.
After
Random words in front of other random words create a random sentence.
Random words in front of other random words create a random sentence.

Bookmark: press Ctrl+D (Windows) or Cmd+D (Mac) to save this tool.

Suggest a New ToolProvide Feedback on This Tool

What does Remove Empty Lines do?

This tool removes the empty lines from your text. A line that only contains spaces or tabs counts as empty, so it is removed too. The lines with text stay in their original order.

Lines with text are not changed. Their spaces are kept, and nothing is joined together. If you want paragraphs to stay separated, tick Keep one empty line between paragraphs and several empty lines in a row become one.

Use it to clean up text copied from websites, PDFs or emails, to tidy lists, or to remove the gaps in code and log files.

Remove empty lines examples

Each example shows the text before and after. The option is off unless the example says otherwise.

CaseBeforeAfter
Example
Random words in front of other random words create a random sentence.

Random words in front of other random words create a random sentence.
Random words in front of other random words create a random sentence.
Random words in front of other random words create a random sentence.
Lines with only spaces or tabs
a
   
b
	
c
a
b
c
Empty lines at the start and end


a
b

a
b
Spaces on text lines are kept
  a  

  b
  a  
  b
Keep one empty line (option on)
a



b

c
a

b

c
Keep one empty line, with edges and space-only lines (option on)


a
  

b

a

b
No empty lines
one
two
one
two

How to remove empty lines

  1. 1
    Add your text
    Paste your text into the box, or import a text file.
  2. 2
    Choose the option
    Tick Keep one empty line between paragraphs if you want paragraphs to stay separated.
  3. 3
    Click Remove Empty Lines
    The empty and space-only lines are removed. Use Undo if you change your mind.
  4. 4
    Copy it
    Click Copy and paste the result where you need it.

When to remove empty lines

Good for

Cleaning text copied from websites, PDFs and emails, tidying lists, and removing the gaps in code and log files.

Check first

Lines with only spaces or tabs count as empty. Lines with text are not changed. Tick the option if paragraphs should stay separated. The result replaces your text, so use Undo if you need the original.

Other tools

To join all lines into one try Remove Line Breaks. To remove repeated lines try Remove Duplicate Lines. To remove spaces at the start and end of lines try Removing Leading And Trailing Spaces.

Remove empty lines FAQ

What does the Remove Empty Lines tool do?

It removes every empty line from your text, including lines that only contain spaces or tabs. The lines with text stay in their original order.

How do I remove empty lines?

Paste your text into the box and click Remove Empty Lines. The empty lines are removed. Click Copy to use the result, or Undo to go back.

Does it remove lines that only have spaces?

Yes. A line with only spaces or tabs counts as empty and is removed.

Are the spaces on my other lines changed?

No. Lines with text are left exactly as they are, including spaces at their start or end. To remove those use Removing Leading And Trailing Spaces.

Does it remove empty lines at the start and end of the text?

Yes. Empty lines at the start, in the middle and at the end are all removed.

Can I keep one empty line between paragraphs?

Yes. Tick Keep one empty line between paragraphs. Several empty lines in a row become one, and the empty lines at the start and end are still removed.

What is the difference between empty lines and line breaks?

An empty line is a line with no text. This tool removes the empty lines only. To join all your lines into one use Remove Line Breaks.

What if there are no empty lines?

Your text is left as it is and you see the message No empty lines found.

Is this tool free and is my text private?

Yes. It is free, needs no account and runs in your browser, so your text is not uploaded to a server.

Looking for more text tools?

Browse Remove Tools

Last updated: 11 November 2026