Text copied from PDFs, emails, and some documents often has a line break at the end of every line, so paragraphs arrive chopped into pieces. Here is how to fix it.
Why the breaks are there
Some sources hard-wrap text: they insert an actual line break at the end of each visible line rather than letting it flow. When you paste that text somewhere with a different width, the breaks stay, and you get a paragraph broken into short, ragged lines.
There are two kinds of break to know about:
- Single line breaks inside a paragraph, the ones you usually want to remove.
- Double line breaks (blank lines) between paragraphs, the ones you usually want to keep.
The careful way to remove them
The trick is removing the breaks inside paragraphs while keeping the breaks between them. In an editor with regex:
- First protect paragraph breaks: replace two line breaks with a placeholder.
- Replace remaining single line breaks with a space.
- Restore the paragraph breaks from the placeholder.
This rejoins each paragraph into a flowing block without merging separate paragraphs into one.
The simple way
If you do not want to fight with regex, paste the text into a cleaner. A cleaner can collapse the runaway breaks and normalize spacing while keeping the real structure. textscrubr also strips the invisible characters and fixes the spacing that copied PDF and email text usually brings along, so you get clean, rejoined paragraphs in one pass.
Watch out for lists and code
Blindly removing every line break will destroy bulleted lists and code, where line breaks are meaningful. A structure-aware approach keeps the breaks that belong to lists and code and only rejoins ordinary prose, so you do not flatten your formatting while fixing the wrapping.
Quick recap
Remove single breaks inside paragraphs, keep double breaks between them, and protect lists and code. A cleaner handles all three at once so hard-wrapped text becomes clean, flowing paragraphs.