Free Tools
Blog

How to Remove Blank Lines From Text Quickly

By Admin Editor · September 22, 2026

Text copied from PDFs, emails or web pages is often full of stray blank lines. A document that should be ten tidy lines ends up as thirty with gaps everywhere. Cleaning it by hand is tedious; doing it in bulk takes a moment.

A clean workspace with a keyboard and notebook

Two kinds of "empty"

Not every blank-looking line is truly empty:

  • Truly empty lines contain nothing at all.
  • Whitespace-only lines contain spaces or tabs. They look blank but a simple "remove empty lines" won't catch them.

A good cleaner treats both as blank, which is why the option "also remove lines that contain only spaces or tabs" is on by default in the Remove Empty Lines tool.

Remove all blank lines, or keep some spacing?

Two goals, two settings:

  1. Remove every blank line — right for lists, code, data and anything that should be a solid block of lines.
  2. Keep one blank line between paragraphs — right for prose. Runs of several blank lines collapse into one, so paragraphs stay separated but the gaps are even.

How to do it

  1. Paste your text into the tool.
  2. Choose whether to treat whitespace-only lines as blank, whether to collapse instead of remove, and whether to trim spaces at the start and end of each line.
  3. Copy or download the result. The number of removed lines is shown.

Your text is processed in your browser and never uploaded.

Line endings

Text from Windows, Mac and Linux uses different line-ending characters (\r\n, \r, \n). A reliable cleaner handles all three, which is important when you paste text from different systems.

Code displayed in a text editor

Where this comes up

  • Text pasted from PDFs, which often insert blank lines mid-paragraph.
  • Exported lists and CSV data with gaps.
  • Code and config files with accidental empty lines.
  • Email replies with layers of quoted spacing.
  • Subtitle and transcript files.

Related clean-ups

FAQ

Why are there still gaps after removing empty lines? The lines may contain spaces or tabs. Make sure the whitespace-only option is ticked.

Will it change anything else in my text? No. Apart from the options you choose, lines are left exactly as they were.

Can I keep single blank lines between paragraphs? Yes. Choose the option to keep one blank line between paragraphs.

Try it now

Use the free Remove Empty Lines tool — no sign-up.

Related reading

Continue with How to Remove Duplicate Lines From a List. Browse the full blog for more guides.