Paritian

Work & Productivity

Remove Empty Lines

Take the blank lines out of a block of text and leave everything else exactly as it was.

Results

Result First line Second line Third line
Lines before 8
Lines after 3
Lines removed 5
Characters after 33

What this tool does

Text copied out of a PDF, an email or a spreadsheet arrives full of gaps — a blank line between every entry, three blank lines where a page broke. This page closes them up and does nothing else: the indentation stays, the trailing spaces stay, the order stays. A line counts as blank when it holds nothing but spaces or tabs.

Formula

throws away lines that hold only spaces or nothing, and leaves the others exactly as they are

Variables

SymbolMeaningUnit
textYour text
OUTResult
LBLines before
LALines after
LRLines removed
CACharacters after

Worked example

  • Your textFirst line Second line Third line
  • ResultFirst line Second line Third line
  • Lines before8
  • Lines after3
  • Lines removed5
  • Characters after33

Limitations

  • The calculation runs entirely in your browser. The values you type are never sent to a server.

Frequently asked questions

How is this different from the text cleaner?

The cleaner does several things at once: it removes blank lines, trims the ends of every line and squeezes runs of spaces into one. That is what you want for text copied out of a PDF, and exactly what you do not want when the indentation matters. This page only removes the blank lines and leaves every other character where it was, which is the right tool for code, for poetry and for anything where the spacing is deliberate.