TextToolboxTextToolbox

Remove Empty Lines

Clear exactly empty rows or whitespace-only rows, trim line edges or shrink existing blank runs, and read a separate count for each kind of blank row.

Built by Saurabh Kumar

Quick Answer

Exactly Empty keeps space-only rows and Whitespace-only removes them. The gap modes shrink blank runs without adding new ones, and the output uses LF line endings. Up to 1,000,000 UTF-16 units and 20,000 physical items are accepted; keep the original when a blank row could be meaningful.

Mode

Clean empty physical lines with a choice between exactly empty and whitespace-only items. You can also collapse existing blank runs, trim line edges or combine trimming with blank removal. No mode guesses paragraph meaning from prose.

0 input items; 0 exactly empty; 0 whitespace-only; 0 retained; 0 removed

Exactly Empty or Whitespace-Only: Two Kinds of Blank Line

Clean empty physical lines with a choice between exactly empty and whitespace-only items. You can also collapse existing blank runs, trim line edges or combine trimming with blank removal. No mode guesses paragraph meaning from prose. Choose it when you want raw empty rows removed while spaces stay, known blank runs shrunk without inventing paragraphs, or blank-record removal compared with line-edge trimming.

  1. Paste a line-based document.
  2. Use Exactly Empty to keep space-only rows, or Whitespace-only to remove rows whose JavaScript trim result is empty.
  3. Choose a gap mode only when existing blank runs should shrink.
  4. Inspect counts, then Copy or Download TXT.

What Each Gap Mode Keeps and Drops

CRLF, LF and CR are recognized and output uses LF. A trailing separator creates a final empty item. The two input counts distinguish exactly empty items from nonempty whitespace-only items. Collapse Existing Blank Runs retains the first original blank item in each run and removes later ones, so two blank items become one. Normalize Existing Gaps and Edges also drops boundary blanks; neither gap mode inserts a missing blank line. Trim Every Line retains blank records, even when a retained item renders as an empty output string.

Reference: ECMAScript trim rules. The browser may already have normalized line endings in a textarea or on the clipboard.

Four Cases With Exact Results

Settings and exact effects
Input and settingResult
A + two blank lines + B, collapse runsA + one blank line + B
A + space-only line + B, exactly emptySpace-only line remains
A + LF + B, gap normalizationA + LF + B, no new gap
One space, Trim Every LineOne retained empty item; output string is empty

When a Blank Line Is Part of the Data

Blank lines can belong to quoted CSV fields, multiline strings or carefully spaced source files. This is physical-line cleanup, not code parsing or paragraph reconstruction. U+200B is not trim-empty. A source with no blank separator between two paragraphs will still have no blank separator after gap normalization.

Up to 1,000,000 UTF-16 units and 20,000 physical items are accepted. Anything larger, or a missing required browser API, clears the result with an error, and the limits say nothing about speed. With empty output both Copy and TXT export are disabled. Keep the original when removing blanks could change meaningful whitespace or record boundaries.

Decide first whether spaces count as a blank row, and keep an original copy when collapsing paragraph gaps or removing boundary records. Use Trim Whitespace for edge-only cleanup, or Add/Remove Line Breaks when the separators themselves should change.