How to Remove Blank Lines in Excel, Word & Online
Blank lines sneak into everything โ copy-pasted PDFs, exported spreadsheets, emails, code. Here's how to remove them in every tool you use, plus the fastest one-click solution.
Just want to remove blank lines right now?
Paste your text and clean it in one click โ free, no signup, works offline.
Jump to
Why blank lines appear in the first place
Blank lines are almost always caused by copying text from one place to another. PDFs add extra line breaks between paragraphs. Spreadsheet exports add empty rows. Email clients add spacing. Web pages add structural whitespace that becomes blank lines when pasted as plain text.
The result is always the same โ your text has random gaps that break formatting, mess up data imports, and make content look unprofessional. Here's how to fix it in every common tool.
Fastest method โ free online tool
The quickest way to remove blank lines from any text โ no matter where it came from โ is to use ScrambleFix's Remove Blank Lines tool. It handles any length of text, runs entirely in your browser, and works offline.
How to use it:
- 1Go to ScrambleFix โ Remove Blank Lines
- 2Paste your text into the input box
- 3Click Run (or press Ctrl + Enter)
- 4Copy the clean output
Remove blank lines in Excel
There are two ways to remove blank rows in Excel:
Method 1 โ Go To Special (fastest)
- 1.Select the entire column or data range
- 2.Press Ctrl + G to open Go To dialog
- 3.Click Special โ select Blanks โ click OK
- 4.All blank cells are now selected
- 5.Right-click โ Delete โ Entire Row
Method 2 โ Filter and delete
- 1.Click any cell in your data
- 2.Go to Data โ Filter
- 3.Click the dropdown arrow on your column
- 4.Uncheck everything except Blanks
- 5.Select all visible rows and delete them
- 6.Remove the filter
Excel formula to check for blank rows
=COUNTA(A1:Z1)=0Returns TRUE for completely blank rows โ use with filtering.
Remove blank lines in Microsoft Word
Word's Find & Replace can remove blank lines using paragraph marks:
- 1.Press Ctrl + H to open Find & Replace
- 2.In Find what: type ^p^p (two paragraph marks)
- 3.In Replace with: type ^p (one paragraph mark)
- 4.Click Replace All
- 5.Repeat until no more replacements are made
๐ก Tip: If blank lines persist after replacing, they may contain spaces. Use ^p ^p (with a space) in the Find field as well.
Remove blank lines in Google Docs
Google Docs has a similar Find & Replace approach:
- 1.Press Ctrl + H to open Find & Replace
- 2.Check the box for Regular expressions
- 3.In Find: type \n\s*\n
- 4.In Replace with: type \n
- 5.Click Replace All
Remove blank lines in VS Code
VS Code supports regex in Find & Replace โ the most powerful option for developers:
- 1.Press Ctrl + H to open Find & Replace
- 2.Click the .* icon to enable regex mode
- 3.In Find: type ^\s*$\n
- 4.Leave Replace empty
- 5.Click Replace All
The regex explained:
^Start of line\s*Zero or more whitespace characters$End of line\nThe newline character itselfRemove blank lines with Python
For bulk processing or automation, Python is the cleanest solution:
Simple one-liner
# Remove all blank lines from a string
text = "\n".join(line for line in text.split("\n") if line.strip())Process a file
with open("input.txt") as f:
lines = f.readlines()
clean = [line for line in lines if line.strip()]
with open("output.txt", "w") as f:
f.writelines(clean)Using regex
import re clean = re.sub(r'\n\s*\n', '\n', text)
Which method should you use?
| Method | Best for | Speed |
|---|---|---|
| ScrambleFix online tool | Any text, any source | โก Instant |
| Excel Go To Special | Spreadsheet data | โ Fast |
| Word Find & Replace | Word documents | โ Fast |
| Google Docs regex | Google Docs | โ Fast |
| VS Code regex | Code files | โ Fast |
| Python script | Bulk/automated processing | ๐ง Setup needed |
Remove blank lines in one click
Paste any text โ from any source โ and get clean output instantly. Free, no signup, works offline.
Try Remove Blank Lines Free