Paste your text and remove every blank line, or keep one between paragraphs. Lines that hold only spaces count as blank. The result updates as you type.
This tool runs entirely in your browser. What you enter is never sent anywhere.Your input is never sent anywhere.
DetailsOptions
What counts as a blank line
A blank line is an empty line, or a line that holds only spaces, tabs, or other whitespace. A line with only spaces looks empty on screen, so it is easy to miss, and the tool treats it as blank.
You choose what happens to blank lines: remove all of them, keep one between paragraphs, leave them alone, or add one after every line. You can also trim spaces, remove duplicate lines, and number the lines.
The result updates as you type. Above the cleaned text, three counts show the lines in, the blank lines before and after, and the lines out.
Where extra blank lines come from
Text copied from a PDF, email, or web page
Copied text often arrives with gaps between lines. Remove them all, or keep one blank line so paragraphs stay apart.
Code, logs, and config files
Clear out empty lines without touching indentation. Spaces at the start of each line stay unless you turn on Remove leading spaces.
Lists for a spreadsheet or a form
Get one item per line with no gaps, drop repeated items, and add line numbers if you need them.
Drafts with uneven spacing
Keep one turns a mix of single, double, and triple gaps into one even blank line between paragraphs.
How to remove blank lines in 3 steps
- Paste your text into the Input text box.
- Under Blank lines, choose Remove all, Keep one, Leave as is, or Add between lines, then set the other options.
- Check the counts and the cleaned text, then click Copy result.
Note: There is no run button. The result updates every time you change the text or an option.
How the cleanup works
- Order of steps: the tool trims spaces first, then handles blank lines, then removes duplicates, then adds line numbers, and finally adds blank lines between lines if you chose that.
- Spaces: Remove trailing spaces is on by default. Remove leading spaces is off, so indentation stays.
- Keep one: runs of blank lines become one empty line, and blank lines at the start and end of the text are removed.
- Duplicates: an exact match after trimming, with the first copy kept. Blank lines are never treated as duplicates, so paragraph breaks stay in place.
- Line numbers: only non-blank lines are numbered, in the form 1. text.
What each option does
The four Blank lines choices and the extra options, with an example use for each.
| Option | What it does | Example use |
|---|---|---|
| Remove all | Deletes every blank line, including lines with only spaces. | Cleaning up code, logs, and lists |
| Keep one | Turns each run of blank lines into one, and drops blank lines at the start and end. | Tightening a draft but keeping paragraphs |
| Leave as is | Keeps blank lines. Only the options below are applied. | Trimming spaces or removing duplicates only |
| Add between lines | Removes the existing blank lines and puts one after every line. | Double-spacing a list |
| Remove trailing spaces | Deletes spaces and tabs at the end of each line. | Cleaning code without changing indentation |
| Remove leading spaces | Deletes spaces and tabs at the start of each line, including indentation. | Flattening a pasted list |
| Remove duplicate lines | Keeps one copy of each line that matches exactly. Optional case-insensitive matching. | Email, keyword, and URL lists |
| Add line numbers | Puts 1. 2. 3. in front of each non-blank line. | Numbered steps and references |
Blank lines are not the same as line breaks
This tool removes the empty lines between your text lines. The line break at the end of each line of text stays, so your lines stay on separate lines. To join the lines of a paragraph into one, use a line break remover instead.
Your text stays in your browser
The tool runs as JavaScript on the page and has no upload step, so private text and code are not sent to a server.
Cleaning up extra blank lines in common situations
A few practical details that decide whether the result looks the way you expect.
Delete every blank line or keep one
Removing all blank lines packs the text tightly, which is right for lists, logs, and code. It also removes the gaps between paragraphs, so prose runs together.
For writing, choose Keep one. Each paragraph break stays as a single blank line, and the extra gaps are gone.
Lines that look empty but are not
A line with a few spaces or a tab on it shows as empty but is not an empty line. A search for empty lines skips it, and it keeps its place in the text.
This tool counts any line with only whitespace as blank. The command grep -v '^$' removes only truly empty lines, so for spaces-only lines you need a pattern such as ^[[:space:]]*$.
Find and replace in Word and other editors
In Word, you can replace two paragraph marks (^p^p) with one (^p), which merges consecutive marks. You may need to run it again until none are left, and lines with only spaces are not matched.
Pasting the text here first removes those lines in one step, and you can paste the result back.
Common problems with blank lines
Blank lines that are not really empty stay behind
A line holds a space or a tab. It looks empty, but a simple search for empty lines does not match it, so the gap remains.
💡 See the solution▼
All paragraphs run together
Removing every blank line also removes the gaps between paragraphs, so the text becomes one block.
💡 See the solution▼
Indentation disappears
Trimming spaces on both sides of each line strips the indentation from code, lists, and Markdown.
💡 See the solution▼
Blank lines are left at the start or end
A few empty lines at the top or bottom of a pasted block are easy to miss and can add gaps when you paste it elsewhere.
💡 See the solution▼
Blank line remover FAQ
Q.Does a line with only spaces count as blank?
A. Yes. A blank line is an empty line or a line that contains only whitespace, such as spaces, tabs, or non-breaking spaces. These lines look empty but are not, which is why a simple find-and-replace often misses them. Remove all and Keep one both treat them as blank. Leave as is does not touch them unless you trim the spaces.
Q.Can I keep one blank line between paragraphs?
A. Yes. Choose Keep one under Blank lines. Any run of blank lines becomes a single empty line, so your paragraphs stay separate. Blank lines at the very start and end of the text are removed. Choose Remove all instead if you want no blank lines at all.
Q.Can I remove blank lines and keep indentation?
A. Yes. Remove leading spaces is off by default, so the spaces at the start of each line stay as they are. Only the spaces at the end of each line are removed, which Remove trailing spaces does by default. This suits code, lists, and Markdown, where the indentation carries meaning.
Q.Does it work with Windows and Mac line endings?
A. Yes. The tool reads Windows (CRLF), old Mac (CR), and Unix (LF) line endings, so text from any of them is cleaned the same way. The result uses plain line breaks.
Q.How do I put a blank line between every line?
A. Choose Add between lines. The tool first removes the blank lines that are already there, then puts one blank line after every line except the last. It is a quick way to double-space a list.
Q.How do Remove duplicate lines and Add line numbers work?
A. Remove duplicate lines keeps the first copy of each line that matches exactly, after trimming. Turn on Ignore case for duplicates to match Apple and apple. Blank lines are never counted as duplicates, so paragraph breaks stay. Add line numbers puts 1. 2. 3. in front of each non-blank line and skips blank lines.
Q.Can I do this in Word, Notepad++, or on the command line?
A. Yes, with some limits. On the command line, grep -v '^$' removes empty lines but misses lines with only spaces, so use grep -v '^[[:space:]]*$' for those. In Word, Find and Replace can turn ^p^p into ^p, but you may need to repeat it until no double paragraph marks are left. This tool handles spaces-only lines and the other options in one step.
Q.Is there a limit on how much text I can paste?
A. The tool sets no limit. It runs in your browser and uses your device's memory. The result is recalculated each time you change the text or an option, so a very large paste can feel slower on an older device.
Q.Is my text sent to a server?
A. No. The tool cleans your text with JavaScript in your browser, and the page has no upload step. Your text is held only in the page while it is open, and closing or reloading the page clears it.
Your feedback
makes this tool better.
Tell us which features you'd like, what should be fixed, or which new tool you'd like to see. An engineer reads every submission and uses it to guide development.