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.

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:
- Remove every blank line — right for lists, code, data and anything that should be a solid block of lines.
- 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
- Paste your text into the tool.
- 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.
- 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.

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
- Delete repeated lines with Remove Duplicate Lines.
- Put lines in order with Sort Lines.
- Change capitalisation with the Case Converter.
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.
