Remove Empty Lines
Strip blank and whitespace-only lines from text, or collapse them to a single spacer.
Cleaned live as you type. Nothing leaves your browser.
Mode
Cleaned text will appear here.
How to remove empty lines from text
Paste your text
Type or paste the text with unwanted blank lines into the input box.
Pick a mode
Remove every blank line, or collapse runs of blanks down to a single spacer line.
Copy the result
The cleaned text and a count of removed lines update live. Copy it with one click.
Why use this tool
Whitespace-aware
Lines that look empty but contain only spaces or tabs are treated as blank and removed too.
Remove or collapse
Delete all blank lines for a tight block, or collapse consecutive blanks to one so paragraphs stay separated.
Trailing space trim
An option strips trailing spaces and tabs from the lines you keep, cleaning up invisible clutter.
Live removed count
A running total shows exactly how many lines were dropped so you can confirm the result.
Private by design
All processing runs on your device. Nothing you paste leaves the page. No upload, no signup.
About this tool
Text copied from PDFs, emails, spreadsheets, and web pages often arrives padded with blank lines. This tool clears them out in one pass. It treats any line that is empty or contains only spaces and tabs as blank, so lines that merely look empty are caught as well.
Two modes cover the common needs. Remove all deletes every blank line for a single tight block, which is ideal for lists and code. Collapse to one keeps paragraph structure by reducing any run of consecutive blank lines to a single spacer, and it also trims blank lines from the very start and end. An optional trailing-space trim tidies the lines you keep by removing invisible spaces at their ends.
Different sources use different line endings, so both Windows and Unix style breaks are normalised before cleaning. A live count shows how many lines were removed. For related cleanup try remove line breaks, remove duplicate lines, or remove extra spaces.
Frequently asked questions
- Does it remove lines that only contain spaces?
- Yes. Any line that is empty or contains only spaces and tabs is treated as blank and removed, not just completely empty lines.
- What is the difference between the two modes?
- Remove all deletes every blank line. Collapse to one keeps a single blank line between blocks of text so paragraphs stay separated, and trims blanks from the start and end.
- Will it handle Windows and Mac line endings?
- Yes. Windows, old Mac, and Unix line breaks are all normalised before cleaning, so the result is consistent regardless of the source.
- What does trim trailing spaces do?
- It removes spaces and tabs at the end of each kept line, which clears invisible whitespace that can cause layout or diff noise.
- Is my data sent anywhere?
- No. Everything runs in your browser as you type. Nothing is uploaded and no account is needed.
Related tools
Remove Line Breaks
Paste text and strip out the line breaks. Replace each break with a space or nothing, keep paragraph breaks, and trim extra spaces.
Remove Duplicate Lines
Paste a list and remove duplicate lines. Match case-insensitively, trim whitespace, keep the first or last copy, and optionally sort the result.
Whitespace Remover
Clean up messy text by trimming lines, collapsing extra spaces, removing blank lines, and stripping line breaks.
Add Line Numbers
Prefix every line of your text with a number. Set where the count starts, choose a separator, pad with leading zeros, and skip blank lines.
Alternating Case Generator
Turn text into aLtErNaTiNg caps, the mocking SpongeBob style.
Case Converter
Switch text between UPPERCASE, lowercase, Title Case, camelCase, snake_case, kebab-case, and more.