Skip to main content
Premier SEO Services

Text tools

Remove Empty Lines

Delete blank lines from text, code or CSV data, including lines that contain only spaces or tabs, or collapse runs of blank lines into one.

  • Runs in your browser
  • Free, no sign-up
  • Unlimited use
  • Updated 30 September 2026

Remove Empty Lines

Paste your text — the result updates as you type

How to use the remove empty lines

  1. 1Paste your text into Text with blank lines.
  2. 2Under Blank lines, choose Remove all or Keep one between blocks.
  3. 3Keep Count lines with only spaces or tabs as empty ticked to catch lines that look empty but aren't.
  4. 4Copy the result from Text without empty lines.

Example

Input
Name,Score

Ana,12
   
Lee,9



Tom,15
Output
Name,Score
Ana,12
Lee,9
Tom,15

Default settings. Six empty lines are removed, including the line with three spaces and the empty line left by the final line break.

Blank vs whitespace-only lines

A line can look empty but contain spaces or tabs, which is common in text copied from web pages, spreadsheets and code editors. With Count lines with only spaces or tabs as empty ticked (the default), those lines are removed too. Untick it to remove only lines that are truly empty.

Remove trailing spaces from every line also strips spaces and tabs at the end of the lines that remain, which keeps diffs and CSV values clean.

Collapsing multiple blank lines

Keep one between blocks replaces any run of blank lines with a single blank line and removes blank lines at the start and end. With the example above it gives Name,Score, a blank line, Ana,12, a blank line, Lee,9, a blank line and Tom,15. This is the same as the “collapse blank lines” setting in many code formatters.

Cleaning CSV and log files

An empty line in a CSV file is read as an empty record by many importers, and a trailing blank line can create an extra empty row. Removing blank lines before importing avoids both.

Rows that contain only delimiters, such as ,,,, are not empty lines, so they stay. Remove them with remove lines containing using the regular expression ^,*$. Windows (CRLF) line endings are handled; the result uses plain line feeds.

Keeping paragraph spacing

If the blank lines separate paragraphs you want to keep, choose Keep one between blocks rather than Remove all. If the problem is the opposite, lines broken in the middle of sentences, use remove line breaks to join lines while keeping paragraph breaks.

Is my text private?

This tool runs entirely in your browser. Your text is not uploaded to our servers.

Questions about the remove empty lines

Does it remove lines that contain only spaces?

Yes, by default. Untick Count lines with only spaces or tabs as empty to keep them.

Can I keep one blank line between paragraphs?

Yes. Choose Keep one between blocks. Runs of blank lines become a single blank line.

Does it handle Windows line endings?

Yes. CRLF line endings are recognized, so lines that contain only a carriage return count as empty. The result uses standard line feeds.

Last updated 30 September 2026Maintained by Premier SEO Services

Report a problem