Guide
How to Remove Line Breaks From Copied Text
Join text copied from a PDF or email into one paragraph. Excel CHAR(10), Word ^p, and regex \r?\n, plus how to keep real paragraph breaks.
What Is Remove Line Breaks?
Remove Line Breaks joins text that has been split across many lines back into one continuous paragraph. Every hard return, along with the spaces around it, becomes a single space, so sentences that were broken mid-line flow together again. The result updates instantly as you paste.
Try Remove Line Breaks →Why Pasted Text Breaks Across Lines
PDFs, emails, and code editors often add a hard line break at the end of every visual row. A hard line break is a stored newline character, not just visual wrapping, which is why pasted text wraps mid-sentence: the newlines travel with it. The text looks fine in its original window, but once you paste it elsewhere those hard returns remain and chop your sentences into fragments. To strip newlines and unwrap text is the quickest way to turn a wall of broken lines back into readable prose.
How It Works
The tool scans for every sequence of line breaks, including any spaces or tabs touching them, and replaces the whole sequence with one space. It then trims the outer edges. "first line" followed by a break and "second line" becomes "first line second line".
This tool is free and runs online entirely in your browser. Your text stays on your device, protecting your privacy: what you enter is not sent to a server, and results appear instantly.
Examples
PDF copy. For example, text copied from a PDF arrives as
The quick brown / fox jumps over on two lines. Join lines and it
becomes The quick brown fox jumps over on one.
An email quote. For example, a forwarded message wrapped at 70 characters reads as a dozen short lines. Removing the hard returns restores the flowing sentences.
No double spaces. For example, a line ending in a space followed by a break collapses to a single space, not two, because each run of breaks and surrounding whitespace becomes one space.
What Are Line Feed (LF) and Carriage Return (CR)?
A line break is stored as one or two invisible characters. A line feed (LF, character 10,
written \n) ends lines on macOS, Linux and the web. Windows files end each line
with a carriage return (CR, character 13, \r) followed by a line feed. So
"remove line feed" and "remove line breaks" usually describe the same job.
This tool treats CRLF, a lone LF and a lone CR as one break each. A pasted Windows file therefore joins cleanly, with no stray carriage returns left inside the result.
How Do You Remove Line Breaks in Excel or Google Sheets?
A line break inside a spreadsheet cell, the kind Alt+Enter makes, is character 10. Replace it
with a space using =SUBSTITUTE(A1,CHAR(10)," "). If the text came from a
Windows file, remove the carriage returns as well:
=SUBSTITUTE(SUBSTITUTE(A1,CHAR(13),""),CHAR(10)," ").
CLEAN also deletes line feeds, but it puts nothing in their place. "end of line[break]next line" becomes "end of linenext line", which is harder to spot than the original problem.
How Do You Remove Line Breaks in Word?
Word marks the end of a paragraph with ^p and a manual line break (Shift+Enter)
with ^l. Text pasted from a PDF often arrives with a paragraph mark at the end
of every visual line, so open Replace with Ctrl+H, find ^p, replace it with a
space, and click Replace All.
To keep the real paragraphs, protect them first. Replace ^p^p with a placeholder
that never appears in your text, such as ###. Then replace ^p with a
space, and finally replace ### with ^p.
How Do You Join Lines With a Regex?
In a regex, \r?\n matches a line break in either Windows or Unix form. In
JavaScript, text.replace(/[ \t]*(?:\r\n?|\n)+[ \t]*/g, ' ').trim() joins every
line, which is what this tool does: it also catches a lone CR, folds blank lines into the same
single space, and trims the ends.
To join lines but keep paragraphs, split on blank lines first and join inside each block:
text.split(/\r?\n\s*\r?\n/).map(p => p.replace(/\s*\r?\n\s*/g, ' ')).join('\n\n').
Two paragraphs of wrapped lines come out as two clean paragraphs.
Removing Line Breaks vs Removing Blank Lines
Removing line breaks vs removing blank lines is the choice that trips people up. This tool deletes every line break and merges the text into one paragraph. Remove Blank Lines does the opposite: it drops empty rows but keeps the remaining lines on their own lines. Joining lines vs normalizing all whitespace is a related decision: normalizing whitespace collapses spaces, tabs, and breaks together, while this tool targets the breaks. Pick the one that matches the shape you want.
Common Mistakes
Related Tools
You May Also Need
You may also need
- Remove Extra SpacesTidy any remaining internal spacing after joining
- Remove Blank LinesDrop empty rows when you want lines kept separate instead
Alternatives
- Normalize WhitespaceCollapse all whitespace and breaks at once