How blank-line removal works
The input is split on \n or \r\n, then each line is tested. With Whitespace on (default), a line is blank if its trimmed value is empty, which catches truly empty rows and rows containing only spaces, tabs, or other Unicode whitespace. With it off, only fully empty rows are dropped; a row with a single space survives.
Surviving lines are rejoined with \n, so the relative order is preserved. The very last newline of the input is dropped if it produced a trailing empty element after the split, which avoids a phantom blank row at the end.
Common workflows pair this tool with others. Run trim whitespace first if you want clean ends on every surviving row. Run remove duplicate lines after if multiple identical rows should also collapse. The transform itself is a JavaScript filter, evaluated locally in your browser on every keystroke.
How to use remove blank lines from text
- 1Paste your text into the input panel on the left.
- 2Read the result with blank rows removed on the right.
- 3Leave Whitespace on to also drop lines containing only spaces or tabs.
- 4Turn the toggle off if rows of pure whitespace should survive.
- 5Click Copy to grab the cleaned text.
Keyboard shortcuts
Drive TextResult without touching the mouse.
| Shortcut | Action |
|---|---|
| Ctrl F | Open the find & replace panel inside the input Plus |
| Ctrl Z | Undo the last input change |
| Ctrl Shift Z | Redo |
| Ctrl Shift Enter | Toggle fullscreen focus on the editor Plus |
| Esc | Close find & replace, or exit fullscreen |
| Ctrl K | Open the command palette to jump to any tool Plus |
| Ctrl S | Save current workflow draft Plus |
| Ctrl P | Run a saved workflow Plus |
What this tool actually does
Drops empty rows by default
A line containing zero characters between line breaks is filtered out. The relative order of remaining lines is preserved, and the line endings between them stay as line feeds in the output.
Whitespace-empty matches optional but on by default
With Whitespace on, the test is line.trim() !== '', so lines with only spaces, tabs, or other Unicode whitespace are also treated as blank. Turn it off to keep those rows, which can matter in fixed-width layouts where a space line is meaningful.
LF and CRLF input both work
The split regex matches \r?\n, so files saved with Windows or Unix line endings produce the same output. The rejoin uses LF; if you need CRLF back, follow with find and replace on \n.
Single linear pass, predictable order
Implemented as Array.prototype.filter over the split array. There is no sorting or hashing involved, so a 100k-row input drops blanks in one walk. The order of surviving rows is exactly the order they appeared in the input.
Runs in your browser, no upload
The transform is a JavaScript filter evaluated on every keystroke in the page. Nothing leaves the page, no log of the input is kept on our servers, and the output panel updates with no network round trip.
Worked example
With Whitespace on, the empty row and the row of three spaces both disappear, leaving the three real lines in order.
First line Second line Third line
First line Second line Third line
Settings reference
| Setting or behaviour | Effect on output |
|---|---|
| Whitespace on (default) | Lines that are empty or contain only whitespace are dropped. |
| Whitespace off | Only fully empty lines are dropped. A row with one space survives. |
| Order of surviving lines | Preserved exactly as in the input. |
| Line endings | Input split on \n or \r\n; output joined with \n. |
| Internal whitespace on surviving lines | Untouched. Use trim whitespace beforehand if surviving rows should also be edge-trimmed. |
| Trailing newline at end of input | Suppressed if it produced an empty final element. No phantom blank row at the end. |
FAQ
Will it drop lines with only spaces or tabs?
Does it preserve the order of surviving lines?
What about lines with stray non-printing characters?
Does it change my line endings?
\n) regardless of input. If your downstream consumer needs CRLF, run the result through find and replace with \n as the pattern and \r\n as the replacement.