Remove Empty Lines

Remove blank lines from text.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Paste text and press Run to delete every blank line, including lines that contain only spaces or tabs. The remaining lines stay in their original order.

How to use

1
Step 1
Paste your text into Input.
2
Step 2
Press Run.
3
Step 3
Copy the compact text from Output.

How it works

A line is removed when it is empty or contains only whitespace. Lines with any visible character are kept exactly as typed, including their leading and trailing spaces.

Worked example

Spaced-out notes

Input
a b c
Output
a b c
Walkthrough
The empty line, the line with two spaces and the two further empty lines are dropped.

Limitations

  • Removes all blank lines, so paragraph breaks disappear too.
  • Does not trim spaces on lines that remain.

Questions

How do I remove blank lines from text?
Paste it and press Run. Empty and whitespace-only lines are deleted.
Will it remove lines that only contain spaces?
Yes. Lines containing only whitespace are treated as empty and removed.
Can I keep one blank line between paragraphs?
Not with this tool. It removes them all.

Features

  • Drops empty and whitespace-only lines
  • Order preserved
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Learn JSON - Full Crash Course

    freeCodeCamp.org

    Structured text formats often sit next to plain-text tools.

    Watch on YouTube
  • HTML Crash Course For Absolute Beginners

    Traversy Media

    Text on the web often starts as HTML you clean or count.

    Watch on YouTube