Remove Blank Lines from Text (Free Online Tool)

Use this free tool to remove blank lines from any text, list or code. Paste your text and every empty line disappears instantly. You can also keep one blank line between paragraphs, trim stray spaces, strip HTML tags or delete duplicate lines.

0Lines before
0Lines after
0Lines removed

Everything runs in your browser. Your text is never sent to or stored on our server.

Quick answer: Paste your text into the top box. The cleaned version, with all blank lines removed, appears in the lower box straight away. Tick the options to strip HTML tags, trim spaces or remove duplicate lines, then click Copy result.

How to remove empty lines with this tool

  1. Paste your text into the first box. It can be plain text, a list of names or URLs, code, CSV data or HTML.
  2. Choose your options. By default, lines that only contain spaces or tabs also count as blank.
  3. Tick Keep one blank line between paragraphs if you only want to squeeze several empty lines down to one, rather than remove them all.
  4. Copy the cleaned text with Copy result. The counters show how many lines were removed.

What each option does

  • Treat lines with only spaces as blank: removes lines that look empty but contain spaces or tabs. Turn it off to remove only truly empty lines.
  • Keep one blank line between paragraphs: keeps your paragraphs apart but removes the extra gaps, which is handy for text pasted from PDFs and emails.
  • Trim spaces: removes spaces and tabs at the start and end of every line. Leave it off for code, where indentation matters.
  • Strip HTML tags: turns HTML into plain text. Paragraph and line-break tags become new lines, scripts and styles are dropped, and codes like & become normal characters.
  • Remove duplicate lines: keeps the first copy of each line and removes repeats, which is useful for cleaning email lists or keyword lists.

Messy HTML is a common reason for broken layouts. If you paste code into WordPress, see our guide to fixing unclosed tag errors in the WordPress editor, and the Google HTML/CSS style guide rules for writing cleaner code.

How to remove empty lines in other apps

If you work in the same file every day, these built-in methods do the same job:

  • Notepad++: go to Edit > Line Operations > Remove Empty Lines, or Remove Empty Lines (Containing Blank characters) to include lines with spaces.
  • VS Code: press Ctrl+H, turn on regular expressions (the .* button), search for ^\s*$\n and replace it with nothing.
  • Microsoft Excel: select the column, press F5, click Special, choose Blanks, then right-click a highlighted cell and choose Delete > Entire row. Check first that the blank cells really are empty rows.
  • Microsoft Word: press Ctrl+H, click More > Special, search for ^p^p and replace it with ^p. Repeat until no more replacements are made.
  • Linux or Mac terminal: sed '/^[[:space:]]*$/d' input.txt > output.txt writes a copy of the file without blank lines.

FAQ

Is there a limit on how much text I can paste?

There is no set limit. Files of several megabytes work fine in a modern browser, though very large files may take a second to process.

Does this tool change my code indentation?

No, not unless you tick Trim spaces. Without it, only the empty lines are removed and every other line stays exactly as it was.

Can I remove blank lines from a CSV file?

Yes. Open the CSV in a text editor, copy everything, paste it here, then paste the result back and save. Empty rows in CSV files are just blank lines.

Is my text uploaded anywhere?

No. The cleaning happens in your browser, so passwords, private notes and client data never leave your computer.

More free tools

See all of them on the QuickOnlineTips free online tools page.