Text tools
Remove blank lines from text
This tool removes blank lines from text and leaves every other line as it was. Paste text or open a UTF-8 file, choose Empty lines only or Whitespace-only lines, then select Remove blank lines. It runs in your browser and shows how many lines it removed and kept.
Processed in your browser
Empty means no characters. Whitespace-only also includes spaces, tabs and Unicode whitespace. Kept lines are never trimmed.
Editor text: CRLF and CR become LF. Load a UTF-8 file to preserve its original line endings. Previews show all line endings as line breaks. Downloads use UTF-8.
Counts appear after processing.
Choose what counts as blank, then remove blank lines.
How to remove blank lines
To remove blank lines, add your text, choose what counts as blank and select Remove blank lines. The result appears under Cleaned text, with the number of input lines, removed lines and kept lines and the size of the result.
- Paste text or open a UTF-8 file
Type or paste into Input text, select Open UTF-8 file, or fill the box with Use example.
- Choose the blank-line rule
Under Blank lines, keep Empty lines only or select Whitespace-only lines to include spaces and tabs.
- Remove blank lines and save
Select Remove blank lines. Check Cleaned text and its counts, then select Copy text or Download .txt.
Editing the text or changing the option clears the old result, so select Remove blank lines again. Cancel stops a run and keeps your input. Reset clears the text, the file and the result and sets the option back to Empty lines only. The status line under the result says how many blank lines were removed.
Empty lines or whitespace-only lines
Empty lines only is the default. It removes lines that hold no characters at all. Whitespace-only lines also removes lines that look empty but hold spaces, tabs or other Unicode whitespace, such as a nonbreaking space. Choose it when the text still shows gaps after a first run.
The Use example text has seven lines: Project plan, an empty line, an indented line, a line with a space and a tab, Café ☕, a second empty line and Next steps. Empty lines only removes 2 lines and keeps 5. Whitespace-only lines removes 3 and keeps 4, because the line with the space and the tab counts as blank too.
A zero-width space (U+200B) is not whitespace to this tool, so a line that holds only that character stays in both modes. The same goes for a line that holds only the NEL control character (U+0085).
What stays the same
Each line the tool keeps comes out as it went in. Indentation, spaces at the end of a line, punctuation, emoji and accents do not change, and no line is trimmed or joined to the next. A blank line goes together with its own line break, so the lines around it close up.
With a loaded file, each kept line keeps its own ending: Windows CRLF, LF, old Mac CR or a Unicode line or paragraph separator. A file with mixed endings keeps the mix. A final line break does not count as an extra blank line, and a last line with no break still has none. A UTF-8 byte order mark at the start of a file stays, even when every line is removed.
Text in the Input text box is different. The browser text box turns CRLF and CR into LF, so load the file when the original endings matter and save the result with Download .txt. The previews display Unicode line and paragraph separators as line breaks too. Editing a file preview switches to editor text with LF endings. Copy text and Download .txt keep the original endings until you edit the input.
Limits
This tool works on plain text. A file must be valid UTF-8, whatever its name or type, or the tool stops with an error that asks you to save it as UTF-8. Pasting from Word or a web page brings only the text, not its formatting.
It removes whole blank lines and nothing else. It does not trim spaces on kept lines, merge runs of spaces or join lines into a paragraph. Blank rows in a spreadsheet or empty paragraphs in a Word file need that program's own commands, since the tool reads plain text only.
There is no set text size limit; your browser's memory is the limit. The tool needs a browser with JavaScript and Web Workers. Download .txt saves UTF-8 text. Copy text copies the same result, but the program you paste into may change its line endings.
Questions
How can I remove all empty lines from text?
Paste the text into Input text, leave Empty lines only selected and select Remove blank lines. Every line with no characters goes in one pass, and the status says how many were removed. If some gaps remain, those lines hold spaces or tabs; choose Whitespace-only lines and run it again.
How do I remove blank lines from a text file?
Select Open UTF-8 file and pick the file, then select Remove blank lines. The file text appears in Input text when the run finishes. Download .txt saves the cleaned text as cleaned-text.txt, and each kept line keeps the line ending it had in your file, CRLF or LF.
How do I remove all empty lines in Notepad?
Copy the text from Notepad, paste it into Input text and select Remove blank lines, then select Copy text and paste the result back. If the file is saved as UTF-8 and its Windows CRLF endings matter, open it here with Open UTF-8 file and use Download .txt instead of the clipboard.
Why are some blank-looking lines still there?
With Empty lines only, a line that holds a single space or a tab is not empty, so it stays. Choose Whitespace-only lines to remove those lines too. A line that holds only a zero-width space or another invisible character that is not whitespace stays in both modes, because the tool counts it as content.
What happens when no line is blank?
The text comes back unchanged and the status reads Complete. No blank lines matched: the output is unchanged. The counts still show the number of input lines. Empty input is also valid and gives an empty result with zero lines, and text made only of blank lines gives an empty result as well.
Is my text uploaded?
No. The file is read and the lines are removed in a Web Worker in your browser, and the text is not sent to a server or saved in browser storage. Copy text writes to your clipboard and Download .txt saves a file only when you select them. Leaving the page clears the text from it.