Line Break Remover
Paste text with unwanted line breaks — from a PDF, email, or hard-wrapped source — and clean it up instantly.
🔒100% Client-Side. Everything runs in your browser — no text is sent to any server.
Input
Output
0 → 0 lines
Why text gets extra line breaks
Text copied from a PDF, an old email client, or a terminal is often hard-wrapped: a real line break was inserted every ~80 characters so the text fit a fixed page or column width. Pasted into a modern editor, every one of those breaks becomes a new paragraph instead of the single flowing paragraph it was meant to be. This tool rejoins those lines while leaving intentional paragraph breaks (a blank line) untouched.
Do it in Python
import re
def join_wrapped_lines(text: str) -> str:
# Split into paragraphs on blank lines, join hard-wrapped lines within each
paragraphs = re.split(r'\n\s*\n', text)
return '\n\n'.join(
' '.join(line.strip() for line in p.split('\n') if line.strip())
for p in paragraphs
)
def collapse_blank_lines(text: str) -> str:
return re.sub(r'\n{3,}', '\n\n', text)
print(join_wrapped_lines(open('pasted.txt').read()))
Do it with sed / awk
# Collapse 3+ blank lines down to 1 blank line
awk 'BEGIN{blank=0} /^$/{blank++; if(blank<=1) print; next} {blank=0; print}' file.txt
# Strip trailing whitespace on every line
sed -i 's/[ \t]*$//' file.txt