Remove Empty Lines

Delete the blank lines from a list, a log, a block of code or text pasted from a web page. You can remove every empty line, squeeze several blank lines down to a single one so paragraphs stay apart, or only trim the blank lines at the very start and end.

Text Cleanup Runs in your browser

Remove Empty Lines

What to do with empty lines

How to Use the Remove Empty Lines

  1. Paste your text.
  2. Decide whether lines with only spaces or tabs count as empty.
  3. Choose to remove all empty lines, squeeze runs to one, or trim only the start and end.
  4. Copy or download the result and check the counts.

About This Tool

Anyone cleaning lists before sorting or counting them, developers tidying code and config files, and writers removing double spacing from pasted text.

Input: Plain text  ·  Output: Plain text.

Features and Limitations

Features

  • Recognises whitespace-only lines, including tabs and non-breaking spaces.
  • Three modes: remove all, squeeze to one, or trim the edges.
  • Reports lines before, after and removed.
  • Leaves the content of non-empty lines exactly as it was.

Limitations

  • Lines that contain invisible characters such as zero-width spaces are not considered empty; use the Invisible Character Detector to find them.
  • Spaces at the ends of the remaining lines are kept; use the Text Trimmer to remove them.
  • Results are computed in your browser; nothing you enter is sent to a server.

Example

“a”, “”, “ ”, “b” becomes “a”, “b” with whitespace-only lines treated as empty, removing 2 lines.

Frequently Asked Questions

What counts as an empty line?

A line with no characters. With the option ticked, a line containing only spaces, tabs or other whitespace is treated as empty too.

How do I keep paragraph spacing?

Choose Keep one where there were several. Paragraphs stay separated by a single blank line.

Will it change my other lines?

No. Only empty lines are removed; everything else is kept character for character.

Can I remove duplicate lines too?

Use the Remove Duplicate Lines tool for that, then come back here if blank lines remain.

Related Tools

More like this: all Text Cleanup tools, all Text & Writing tools or the TinySandy home page.