Skip to content

Remove empty lines

Delete blank lines from text, lists, code or exported data in one step. Optionally keep single blank lines between paragraphs and trim spaces at line ends.

  • Free, no limits
  • No sign-up
Everything happens in your browser; your data is never uploaded.
  • ✓ Free
  • ✓ No sign-up
  • ✓ Nothing uploaded

Next step

What to do next

How to use it

  1. Paste your text or open a .txt, .csv, .md or .log file.
  2. Choose whether to keep paragraphs and how to treat space-only lines.
  3. See how many lines were removed.
  4. Copy or download the cleaned text.
Try it now

What the tool removes

By default every empty line is deleted, and the remaining lines are joined directly one after another:

Before

First line


Second line
   
Third line

After

First line
Second line
Third line

Three options control the details:

  • Keep paragraphs. Instead of deleting every blank line, runs of several blank lines are collapsed into a single one. Paragraph structure stays, extra gaps disappear. Blank lines at the very start and end are removed.
  • Treat lines with only spaces as empty. On by default. A line that contains only spaces or tabs looks empty, so it is removed too. Turn this off if you only want to remove truly empty lines.
  • Trim trailing spaces. Removes invisible spaces and tabs at the end of every line, which often cause trouble in code, CSV files and diffs.

The note under the result tells you how many lines were removed.

Why blank lines appear

Most stray blank lines come from a mismatch between line-break styles. Windows uses two characters (CR + LF) to end a line, while macOS and Linux use one (LF). When text passes between systems or through web forms, a single line ending can be read as two, doubling every break. HTML emails and rich-text editors also add an empty paragraph between lines. The tool normalizes all line endings, so after cleaning you get one consistent style.

Typical situations

  • Text copied from web pages and emails, which often has a blank line between every line.
  • Lists exported from spreadsheets or databases, with empty rows where data was missing.
  • Log files and command output, where blank lines make scanning harder.
  • Code with too much vertical whitespace (use Keep paragraphs so logical blocks stay separated).
  • Subtitles, lyrics and poems where you want a compact version for printing.

You can open text files directly with Open file (.txt, .csv, .md, .log and other plain-text formats) instead of copying and pasting. The file is read by your browser; nothing is uploaded.

Blank lines in CSV files

In a CSV file, an empty line is an empty row. Many import tools treat it as a record with missing values, or stop reading at it. Removing blank lines before import avoids both problems.

Be careful with CSV fields that legitimately contain line breaks inside quotes, such as a multi-line address. Removing an empty line inside such a field changes the field's content. If your file has quoted multi-line fields, check the result before importing, or clean the data in a spreadsheet program instead.

Related cleanups

Blank lines are often only one of several problems in messy text. These tools handle the others:

Use Use result as input to run several cleanups one after another without copying back and forth.

How lines are counted

Every line break starts a new line, whether it comes from Windows (CRLF), macOS or Linux (LF). The output always uses simple LF line breaks, which every modern editor, spreadsheet and website understands. To see the counts of empty and non-empty lines before and after, paste the text into the line counter.

Frequently asked questions

How do I remove blank lines from text?

Paste the text into the box. Empty lines are removed immediately; copy or download the result.

Can I keep one blank line between paragraphs?

Yes. Turn on “Keep paragraphs” and multiple blank lines are collapsed into one instead of removed.

Are lines with only spaces removed too?

By default, yes. Turn off “Treat lines with only spaces as empty” to remove only completely empty lines.

Can I clean a file directly?

Yes. Use “Open file” to load a .txt, .csv, .md or .log file, then download the cleaned version.

Is my text uploaded?

No. Everything runs in your browser.

Last updated: November 12, 2026

Recommended

Similar tools

If Remove empty lines helped, you may need these too.

See all in category →

People also use