Strip spaces and tabs from the start or end of every line
Remove Empty Lines
Close up the gaps in text pasted from a PDF, an email or a spreadsheet.
Loading tool…
How to use remove empty lines
Paste your text.
Choose whether lines with only spaces count as empty.
Choose to remove every blank line or keep one between blocks.
Copy or download the result.
What this tool does
- Removes empty lines and, if you like, lines holding only spaces or tabs.
- Can squeeze runs of blank lines down to one, keeping paragraphs apart.
- Keeps your line endings and reports how many lines were removed.
How the result is verified
The result is scanned again: with "keep one" on, no two blank lines may sit together or at the ends; otherwise no blank line may remain.
Frequently asked questions
Will it remove lines with only spaces?
Yes, with "Lines with only spaces count as empty" on (the default). Turn it off to remove only truly empty lines.
Can I keep paragraph breaks?
Yes. Turn on "Keep one blank line between blocks" and runs of blank lines shrink to one instead of disappearing.
Is my data uploaded to a server?
No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.
Related tools
Collapse runs of spaces and tabs into one space
Hidden characters, spaces, blank lines and quotes cleaned in one pass
Delete repeated lines, keep order, ignore case or spaces
Paragraph count with words per paragraph, split your way