Remove Empty Lines and Blank Lines
Delete blank lines or squeeze them down to one.
Removed 0 empty lines
Use via API
Remove blank lines from text, or collapse runs of blank lines into one. Send JSON, get JSON back.
POST https://pithlab.com/api/v1/tools/remove-empty-lines
curl https://pithlab.com/api/v1/tools/remove-empty-lines \
-H "Authorization: Bearer $PITHLAB_KEY" \
-H "Content-Type: application/json" \
-d '{"input":"First line\n\n\nSecond line\n \nThird line"}'About the Remove Empty Lines
Delete blank and whitespace-only lines from text, or collapse runs of empty lines into one. Keeps your line endings and works instantly in the browser.
How to use the Remove Empty Lines
- Paste your text into the input box.
- Choose whether lines containing only spaces or tabs count as empty.
- Tick Keep one blank line between blocks to collapse gaps instead of removing them completely.
- Copy the cleaned text or download it as a file.
Examples
Input
First Second Third
Output
First Second Third
Input
Para one Para two Para three
Output
Para one Para two Para three
Frequently asked questions
What counts as an empty line?
A line with no characters at all. With Treat whitespace-only lines as empty switched on, which is the default, lines containing only spaces, tabs or other invisible whitespace are removed too.
Will it change the rest of my text?
No. Non-blank lines are kept exactly as written, including indentation, and Windows (CRLF) line endings are preserved.
What does collapsing do?
Collapsing replaces each run of blank lines with exactly one, which keeps paragraphs separated while removing extra gaps. Blank lines at the very start and end are removed.