Why text ends up full of blank lines and how to fix it
The common causes of stray empty lines when copying and pasting, plus when to strip every blank and when to keep paragraph gaps.
Where extra blank lines come from
Blank lines rarely appear on purpose. They creep in when you copy from a PDF that adds a break after every visual line, when an email client double-spaces quoted replies, or when a spreadsheet export leaves empty rows between records. Word processors also insert paragraph marks that turn into blank lines once the styling is stripped away in plain text. Because these gaps are made of invisible characters, the clutter is easy to see but tedious to delete by hand.
Empty versus whitespace-only lines
There are two kinds of blank line, and they trip people up differently. A truly empty line has nothing between two newlines, while a whitespace-only line looks empty but actually holds spaces or tabs. A find-and-replace that only targets consecutive newlines will leave the whitespace-only lines behind, so the text still looks ragged. This tool treats both the same by checking whether a line has any non-whitespace character, which is why a line of three spaces is removed just like a fully empty one.
When to strip all blanks and when to keep one
For a compact list, a set of values, or a block you plan to paste into a narrow field, removing every blank line gives the tightest result. For prose, though, you usually want the paragraph breaks to survive so the text stays readable. That is what the collapse option is for: it keeps a single blank line between blocks and removes only the extra ones. Choosing the right mode depends on whether the structure of your text carries meaning.
Cleaning code and data safely
Source code and pasted data need a gentler touch than prose. Blank lines between functions or CSV records are often noise you can safely drop, but the indentation inside a line is meaningful and must be preserved. Leaving 'Trim each line' off keeps every leading space exactly where it was while still deleting the empty lines around your content. If you do trim, remember it will also strip alignment spaces at the start of kept lines, which can matter for Python or Makefiles.