Remove Blank Lines

Remove blank lines from text in your browser: paste it, choose what happens to empty lines, run it, and copy the clean result. Free, no login, nothing leaves your device.

Empty line handling

Remove all deletes every blank line. Collapse repeats keeps one blank line between paragraphs. Trim edges only clears blank runs at the start and end.

Paste text or open one .txt file (max 1 MiB).Removal runs locally in your browser.
What counts as a blank line

A line counts as blank when it holds nothing or only spaces, tabs, and non-breaking spaces; lines with any words or characters always stay. Removed blank lines take their line breaks with them, so no stray gaps remain, and the line breaks between content lines never change. Nothing in your text is uploaded.

How this site handles data
Illustration of empty gaps between printed text lines being erased from a page with a brass eraser tool, leaving the text lines tight together
Tight text, same words: the only job of a blank line remover.

Empty lines out, everything else untouched

Pasted text grows empty lines everywhere: CSV exports double-space every row, logs pad their output, forms submit blank fields, and Word documents carry trailing presses that turn into gaps. A remove blank lines tool deletes those gaps while the words, the spacing inside lines, and the line breaks between content lines stay exactly as you typed them.

The definition is written out, not implied: any line holding only spaces, tabs, or non-breaking spaces counts as blank here, because ranking tools disagree about exactly that. When your text needs paragraphs, Collapse repeats keeps one blank line between them. For joining wrapped sentences instead, use the Line Break Remover; for doubled spaces inside lines, the Whitespace Remover.

What counts as a blank line, and what each mode deletes

One definition, three modes, no surprises: a line is blank when it holds only spaces, tabs, and non-breaking spaces, or nothing at all. Delete every empty line or keep paragraph breaks; the table is the exact behavior of the tool above, pinned by this site's automated tests.

Line patternExampleRemove allCollapse repeatsTrim edges
Empty linea bremovedrun collapses to oneinterior kept
Spaces or tabs onlya bremovedrun collapses to oneinterior kept
Non-breaking spaces onlya   bremovedrun collapses to oneinterior kept
Blank run (2+ lines)a ball removedone blank line keptinterior kept
Blank run at start or end a b removedremovedremoved
Line with any contenta b bkept as typedkept as typedkept as typed

Content lines and the breaks between them never change in any mode. CRLF pastes behave like LF, and a run of blank lines collapses to one clean empty line, not the first messy one. Removed blank lines take their line breaks along, so no stray gaps remain and the output never ends with a trailing break.

One double-spaced paste, three outcomes

A padded export run through every mode. Red marks the blank lines each mode strikes; paragraph people get Collapse repeats.

Text with blank lines
Item one
⏎
Item two
·
⏎
⏎
Item three
·
⏎
Item four
Remove all
Item one
Item two
Item three
Item four
Collapse repeats
Item one

Item two

Item three

Item four
Trim edges
Item one

Item two
 


Item three
 

Item four

Every output is computed from the same original by the engine this site ships; your input is never modified until you run the tool.

How to remove blank lines from text

  1. 01

    Paste or open

    Paste the text, or open one .txt file up to 1 MiB. The file is read in your browser and never uploaded.

  2. 02

    Pick a mode

    Remove all for tight lists, Collapse repeats to keep one blank line between paragraphs, Trim edges to only clear the start and end. Switching after a run recomputes from your original input.

  3. 03

    Copy or download

    Copy the clean text anywhere, or download it as a .txt file. The Removed tab shows every blank line that was deleted, in place.

How to Remove Blank Lines in Code Editors, Office & Regex

Need to clean empty or whitespace-only lines without leaving your workflow? Here are the exact shortcuts, regular expressions, and commands for popular editors and environments.

VS Code

Regex

Press Ctrl+H (Cmd+Option+F on Mac), toggle Regular Expression mode (Alt+R), and replace with nothing to delete empty lines and their line breaks.

^\s*$\n

Notepad++

Menu & Regex

Go to Edit > Line Operations > Remove Empty Lines (Containing Blank characters). Or use regex Find & Replace to clear whitespace runs.

^[ \t]*[\r\n]

Microsoft Word

Paragraph Marks

Press Ctrl+H. Enter ^p^p in Find what and ^p in Replace with. Click Replace All repeatedly until 0 replacements remain to collapse double spacing.

Find: ^p^p → Replace: ^p

Excel & Google Sheets

Filter & Delete

Select the data column, press F5 (or Ctrl+G) > Special... > Blanks > OK. Right-click any highlighted cell and select Delete > Entire row.

F5 > Special... > Blanks > Delete Entire Row

Terminal (sed / awk)

CLI

Strip whitespace-only and empty lines directly in your macOS or Linux terminal using standard stream utilities.

sed '/^[[:space:]]*$/d' input.txt > output.txt

Python 3

Script

Filter lines where line.strip() is empty. This catches both zero-length lines and lines holding only invisible spaces or tabs.

clean = [line for line in text.splitlines() if line.strip()]

Remove blank lines FAQ

How do I remove blank lines from text?

Paste the text into the remover above, keep the default Remove all mode, and press Remove blank lines to delete every empty line. Copy the result or download it as a .txt file. It is free, needs no account, and everything runs in your browser.

What counts as a blank line here?

Any line that holds nothing, or only horizontal whitespace: spaces, tabs, and non-breaking spaces. That includes the invisible lines pasted from PDFs and spreadsheets. A line with any words, numbers, or symbols is a content line and never gets removed, in any mode.

Can I keep one blank line between paragraphs?

Yes, that is the Collapse repeats mode: every run of two or more blank lines collapses to exactly one clean empty line, so paragraph structure survives while the double-spacing goes. Edge blank runs at the very start and end of the text are removed entirely.

Will my normal line breaks be removed too?

No. The tool removes blank LINES, not line breaks: the break between two content lines always survives in every mode. If you want wrapped lines joined into paragraphs, that is the Line Break Remover, a separate tool for the opposite job.

Why did a line with only spaces disappear?

Because it counts as blank: a spaces-only or tabs-only line carries no content, so Remove all deletes it like any empty line. The Removed tab marks those lines with dots so you can see exactly which ones went.

How do I remove blank lines in Word, Notepad++, or VS Code?

In Word, press Ctrl+H and replace ^p^p with ^p repeatedly. In VS Code, enable regex mode (Alt+R) and replace ^\s*$\n with nothing. In Notepad++, use Edit > Line Operations > Remove Empty Lines. For one-off pastes or text where you want to preview removals first, use the browser tool above.

Can it delete empty rows in Excel?

Not directly: spreadsheets need their own empty-row handling, and Excel has a built-in Remove Blanks on the Home ribbon. For a single column, copy it here, remove the blank lines, and paste it back; the values and their order survive.

Is it free, and is my text uploaded anywhere?

It is free with no account, and the removal runs entirely in your browser with JavaScript. Opened files are read locally; no text or file content is sent to a server. Site analytics, if enabled, track page visits, never your text.

For Word and Docs formatting controls, read the formatting guide.

Joined lines but want empty ones gone too? Remove Blank Lines deletes or collapses them.Blank lines removed but spaces doubled inside lines? Whitespace Remover collapses them. Marks gone but empty lines left? Remove Blank Lines cleans the gaps.