Remove empty lines

Handy for tidying lists copied from spreadsheets or web pages before you paste them elsewhere.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter text and treat whitespace-only lines as empty.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

The text is split into lines, every zero-length line is dropped (or every line holding only whitespace, when that option is on), and the rest are joined in order.

Example

Inputs: Treat whitespace-only lines as empty = yes. Result: Result: Apples Oranges Bananas Grapes; Lines removed: 4; Lines left: 4.

Apples

Oranges
   
Bananas


Grapes
Apples
Oranges
Bananas
Grapes

Limits and caveats

  • A line holding an invisible space counts as empty only when the whitespace option is on.
  • The result uses one standard line break between lines.

Questions about this tool

Does it change the order of lines?

No. Non-empty lines keep their original order.

What is the difference between an empty line and a whitespace line?

An empty line has no characters at all. A whitespace line looks empty but holds spaces or tabs, and you choose whether to drop it.

Does it remove duplicate lines too?

No, it only removes blank lines. Use the duplicate line remover for repeats.