Remove Empty Lines is a browser-based drain removal tool that strips completely blank or whitespace-only rows from pasted plain text while leaving every retained line exactly as it was entered. To use it, paste your text into the input box, choose whether whitespace-only lines count as empty (default) or whether to remove only zero-length lines, then process the result and verify the removed-versus-retained line counts shown beneath the output. Nothing is uploaded, no text is reformatted inside retained lines, and the tool handles inputs up to 1,000,000 UTF-16 code units without sampling or silent truncation. The single decision the tool makes per line is whether the selected blank-line predicate matches; everything else—indentation, casing, internal whitespace, and punctuation—stays in place. Whether you arrived looking for a literal drain unclogger or landed here for a text editor's blank-row cleanup, this page describes the second meaning and walks you through every option of the Remove Empty Lines utility.
In the realm of plain-text editing, the word "drain" works as a useful metaphor for an unwanted gap that interrupts the flow of content. Blank rows between paragraphs, double-spaced list items, and stray whitespace-only lines left behind by editors, spreadsheets, or IDE exports all behave like a clogged drain in a document: they slow scanning, bloat file size, and make downstream tooling work harder. A text-oriented drain removal tool therefore has one job—to identify which rows carry no useful payload and skip them when rebuilding the result. The Remove Empty Lines tool on this site is built around exactly that single decision.

What Counts as a Drain Removal Tool for Plain Text
Within a text-tools site, a drain removal tool is any utility that detects rows carrying no meaningful payload and subtracts them in a single pass. Two distinct definitions of "empty" exist in plain-text work, and confusing them is the most common reason a blank-row cleanup damages content:
- Strict empty row: a line whose UTF-16 code-unit length is zero. No characters at all between the previous newline and the next.
- Whitespace-only row: a line that looks blank in a viewer but actually contains spaces, tabs, non-breaking spaces, or other Unicode whitespace that a browser's String.trim() would remove.
Remove Empty Lines exposes both definitions as a single toggle. Visually blank rows almost always fit the whitespace-only category, so the option is enabled by default. Authors working with source code, tabular data exports, or staged configuration where an indentation-only row carries meaning should flip the toggle off so those rows survive. Choosing the right predicate is the only real judgment call you make when you open Remove Empty Lines; everything else is mechanical.
How to Run a Drain Removal Pass With Remove Empty Lines
The steps below follow the documented operating steps and add the boundaries readers ask about most often. A "pass" means a single ordered evaluation from the first line to the last.
- Paste text containing blank rows into the input box. The tool accepts up to 1,000,000 UTF-16 code units, which covers most prose documents, CSV exports, and code files. Inputs that mix CRLF, standalone CR, and LF endings are all parsed correctly because the splitter checks CRLF before CR before LF, so no row is double-counted.
- Keep the whitespace-only option enabled for visual blanks, or disable it to remove zero-length lines only. Leaving the option on is the safest starting point, because invisible indentation is the most common cause of "blank" rows that are actually whitespace-only. Disable it only when you specifically need to keep rows that contain nothing but indentation or stray spaces.
- Process the text with the action button. The implementation makes a single pass, evaluates the active predicate for each line, appends retained values in original order, then joins them with LF line endings regardless of what the source used. Mixed source endings therefore normalize to one consistent boundary style in the output.
- Verify the removed and retained counts shown beneath the result. The summary tells you how many input lines were examined, how many were kept, and how many were discarded. Treat those numbers as a sanity check before pasting the cleaned output over your original file—especially for programming languages or formats where blank rows aid readability.
Changing either the input text or the option clears the previous output and counts immediately, so you can re-run the pass without a manual reset. The result is ready to copy or download as soon as the counts appear.
Choosing Between Whitespace and Strict Empty Removal
The two modes target different source materials, and the table below summarizes when each one is the safer default.
| Scenario | Whitespace-only (default) | Strict empty-only |
|---|---|---|
| Pasted prose with double returns between paragraphs | Recommended | Misses visual blank rows |
| Markdown drafts exported from rich editors | Recommended | Misses rows containing only spaces |
| Spreadsheet exports with empty cells | Recommended | Misses single-space placeholders |
| Source code where indentation rows matter | Risk of losing intentional whitespace | Recommended |
| Configuration files staged for diff | Risk of collapsing structurally important rows | Recommended |
| Logs containing tab-only separators | Removes the tabs as if empty | Keeps the tab rows untouched |
The practical rule is: keep the default on unless you have a reason to inspect indentation-only rows visually. Turning the toggle off is a diagnostic move, not a cosmetic one—it preserves whitespace-only rows for follow-up review, which matters when another tool later distinguishes empty from near-empty records.
What Happens to Lines That Are Kept
Every retained line is preserved exactly. No leading indentation is trimmed, no trailing spaces are dropped, no internal runs of spaces are collapsed, and no letter casing or punctuation is rewritten. The tool does not wrap prose, sort records, deduplicate values, or normalize Unicode. Its only action is the line-by-line predicate evaluation, after which retained code units are reassembled in original order. This means the character set, the spacing, and the casing all survive into the output unchanged.
For readers who want the underlying mechanism spelled out: the whitespace predicate relies on the browser's JavaScript String.trim() implementation, which is Unicode-aware and treats spaces, tabs, non-breaking spaces, and other recognized whitespace characters as removable. The strict predicate, by contrast, only fires when a line has zero code units. The split itself runs against the documented behavior of JavaScript String.split(), with CRLF handled before lone CR or LF so the row count is always reliable.
Input Limits, Errors, and Local Processing
The cap is 1,000,000 UTF-16 code units, which is the predictable ceiling for browser memory and DOM rendering. Text at the exact limit is accepted; one additional code unit causes a visible error and produces no partial output. The tool never samples, slices, or silently truncates a large input. Empty input is rejected before processing to avoid an ambiguous report that could otherwise count the absence of text as one removable line. A whitespace-only input is valid—the outcome simply depends on which option is active. With whitespace-only removal enabled, the result is an empty string with one removed line; with strict empty-only removal, the whitespace line remains.
All filtering, counting, and output generation happen locally in the browser. There is no upload, no remote API, no third-party dependency, and no user-supplied regular-expression pattern. Nothing is stored, and nothing leaves the tab. If you need a complementary duplicate-row cleanup right after the blank-row pass, Remove Duplicate Lines uses the same local-processing model so you can chain both utilities without leaving the browser.
Related Tools Worth Pairing With a Drain Removal Pass
Once blank rows are removed, several other text utilities finish the cleanup without reformatting the retained content:
- Line Break Remover for collapsing line breaks into single spaces or paragraphs while preserving every other character.
- Whitespace Remover for collapsing horizontal spacing or stripping every whitespace character (a heavier pass than the empty-line step covered here).
- Line Counter for an independent recount of total, non-blank, and blank lines against the cleaned output.
- Text Diff Checker for a line-by-line comparison between the original and cleaned files before you overwrite either.
For more scenario-specific walk-throughs, see the guide to removing empty lines in a Word document or the Excel-specific cleanup walk-through; each one returns you here when a browser-based pass is faster than the host editor's native command.