CSS Portal

Remove Empty Lines

Paste any text or list and every blank line is removed as you type. Choose whether to remove all blank lines, keep single blank lines between paragraphs, or only trim blank lines from the start and end. Lines that contain only spaces or tabs count as blank too, and trailing spaces can be tidied at the same time.

It’s useful for cleaning up text copied from PDFs, emails, spreadsheets and web pages, lists exported from other tools, or code with too much vertical space. Everything runs in your browser, so your text never leaves your device.

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Blank lines

INYour text

OUT

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee

About this tool

Three ways to clean up

  • Remove all deletes every blank line, so each line of text follows straight on from the last. This is the best choice for lists.
  • Keep one between paragraphs reduces any run of blank lines to a single one, so paragraphs stay separate. Blank lines at the start and end are removed.
  • Only at start and end leaves the inside of your text alone and removes blank lines before the first line and after the last.

Lines that look empty

A line can look empty but still contain spaces, tabs or non-breaking spaces, especially in text copied from web pages, PDFs or Word. With Treat space-only lines as blank switched on (the default), those lines are removed too. Switch it off to remove only lines that are completely empty.

Tidying the lines you keep

Trim trailing spaces removes invisible spaces at the end of each line, which often cause problems in code and data. Trim leading spaces removes indentation, so leave it off for code. Remove duplicate lines keeps the first copy of each line. For more control over duplicates, use the Duplicate Line Finder.

Private and fast

Everything happens in your browser: nothing is uploaded or stored. Your option choices are remembered on this device, but your text isn’t. Large files of hundreds of thousands of lines are cleaned in a moment, and Windows (CRLF) line endings are handled automatically.

Frequently Asked Questions

What does the Remove Empty Lines tool do?

It removes blank lines from any text or list. Paste your text and the cleaned result appears as you type. You can remove every blank line, keep a single blank line between paragraphs, or only remove blank lines at the start and end. It can also trim spaces from the ends of lines and remove duplicate lines.

What counts as an empty line?

A line with nothing on it is always empty. With Treat space-only lines as blank switched on, which is the default, lines that contain only spaces, tabs or non-breaking spaces count as empty too. A line break at the very end of your text doesn’t count as an empty line.

How do I keep paragraphs separate?

Choose Keep one between paragraphs. Any run of two or more blank lines is reduced to one, so paragraphs stay separate but extra gaps disappear. Blank lines at the very start and end are removed.

Will it change the lines I keep?

Only if you ask it to. Trim trailing spaces (on by default) removes spaces and tabs at the end of each line, and Trim leading spaces (off by default) removes indentation. With both switched off, every line you keep is exactly as it was.

Can it remove duplicate lines too?

Yes. Switch on Remove duplicate lines to keep only the first copy of each line. Lines are compared after spaces at the start and end are ignored, and the comparison is case-sensitive. For options such as ignoring case, counting duplicates or seeing where they are, use the Duplicate Line Finder.

How do I copy or save the result?

Use Copy to copy the whole result to your clipboard or Download to save it as a text file. Use replaces your text with the result so you can make another pass. Press Ctrl+Z to undo it.

Is my text uploaded anywhere?

No. The tool runs entirely in your browser, so your text never leaves your device and nothing is stored. Only your option choices are remembered, so the tool opens the way you left it.

Is there a size limit?

There’s no fixed limit for pasted text. Files of up to 25 MB can be opened with the Open button, and even very long texts are cleaned almost instantly on a modern device.

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee