Remove Line Breaks
Remove unwanted line breaks from text copied from a PDF, an email or a website. Join the lines with spaces, keep your paragraphs, remove the breaks completely or only the blank lines, or replace each line break with a comma, and fix words that were split with a hyphen at the end of a line.
- Keeps paragraphs
- Fixes PDF text
- Stays on your device
- Line breaks before
- 0
- Line breaks after
- 0
- Line breaks removed
- 0
- Characters
- 0
How to remove line breaks
Remove line breaks from any text in three steps with this line break remover.
-
Paste your text
Text from a PDF, an email, a chat or a web page. You can also open a .txt file.
-
Choose what to do
Replace with spaces joins every line into one paragraph. Keep paragraphs joins lines but keeps the blank lines between paragraphs. Remove completely, Remove blank lines only and Replace with… do what they say.
-
Copy the clean text
The result updates as you type. Copy it, download it, or press Use result as input to clean it further.
The sample has 5 line breaks. With Replace with spaces and Rejoin words split with a hyphen on, it becomes one line of 99 characters: …This is the second paragraph.
Line break remover features
More than a find-and-replace for line breaks.
-
¶
Keep paragraphs
Join the lines inside each paragraph but keep the gap between paragraphs.
-
PDF
Fix PDF text
Rejoin words that a PDF split across two lines with a hyphen, like para- graph.
-
,
Replace with anything
Turn a list into comma-separated text, or put any text you like where each line break was.
-
\r\n
Every line ending
Windows (CR LF), Mac and Linux (LF) and old Mac (CR) line breaks are all removed.
Five ways to remove line breaks
The sample text with each option (spaces at line ends trimmed and double spaces turned into one):
| Option | Result | Use it for |
|---|---|---|
| Replace with spaces | This sentence was copied from a PDF, so every line ends with a break. This is the second para- graph. | One block of text, for a form or a post. |
| Keep paragraphs | This sentence was copied from a PDF, so every line ends with a break.⏎⏎This is the second para- graph. | PDF and email text you want to keep readable. |
| Remove completely | This sentence was copiedfrom a PDF, so every lineends with a break.This is the second para-graph. | Chinese, Japanese or Thai text, where lines join without a space. |
| Remove blank lines only | Every line is kept, without the empty line between the paragraphs. | Lists and code: remove empty lines you don’t want. |
| Replace with… “, ” | This sentence was copied, from a PDF, so every line, ends with a break., This is the second para-, graph. | Lists you want as comma-separated values. |
⏎ marks a line break. Tick “Rejoin words split with a hyphen” to turn para- graph back into paragraph.
How to remove line breaks without removing paragraphs
Text copied from a PDF usually has a line break at the end of every line, plus a blank line between paragraphs. Choose Keep paragraphs: the lines inside each paragraph are joined with a space, and each paragraph stays separate, with one blank line between them.
To remove paragraph breaks as well, choose Replace with spaces instead. Keep paragraphs works when the paragraphs in your text are separated by an empty line. If they aren’t, every line is joined into one paragraph, the same as Replace with spaces.
Remove line breaks from PDF text
PDFs store text as lines on a page, not as paragraphs, so copying from a PDF gives you a line break wherever a line ended on the page. Long words are often split at the end of a line with a hyphen, too.
- Paste the copied text and choose Keep paragraphs (or Replace with spaces for one block).
- Tick Rejoin words split with a hyphen at the end of a line: para- at the end of one line and graph at the start of the next become paragraph.
- Leave Turn double spaces into one on to tidy the spacing.
A hyphen is only removed when a letter comes before it and a small letter starts the next line, so check compound words like well-known that happened to fall at the end of a line. To count the words in a PDF without copying it, use the PDF Word Counter.
Line breaks in Windows, Mac and Linux
A line break isn’t always the same character. The tool removes all three kinds:
| Line break | Characters | Used by |
|---|---|---|
| CR LF | \r\n | Windows, and many emails and web forms |
| LF | \n | macOS, Linux, Android and iPhone |
| CR | \r | Mac OS 9 and older Macs |
A text that mixes them, for example after copying between apps, is cleaned in one go.
Remove line breaks in Word, Excel and Google Docs
- Word: press Ctrl+H to open Find and Replace. Type ^p in Find what for a paragraph mark (or ^l for a manual line break made with Shift+Enter) and a space in Replace with, then Replace All.
- Excel: select the cells, press Ctrl+H, click in Find what and press Ctrl+J to enter a line break (the box looks empty), type a space in Replace with and Replace All. A formula such as
=SUBSTITUTE(A1,CHAR(10)," ")does the same in a new column. - Google Docs and other editors: paste the text here, choose an option, and copy the result back.
To count the lines and blank lines in your text before you remove them, use the Line Counter.
Remove line breaks FAQ
How do I remove line breaks from text?
Paste the text and choose Replace with spaces. Every line break becomes a space and the text becomes one paragraph. Copy the result.
Can I remove line breaks but keep paragraphs?
Yes. Choose Keep paragraphs. Lines inside a paragraph are joined, and paragraphs separated by a blank line stay separate.
How do I remove only the empty lines?
Choose Remove blank lines only. Every line with text is kept, and lines that are empty or only spaces are removed.
How do I replace line breaks with commas?
Choose Replace with… and type a comma and a space. A list of one item per line becomes comma-separated text, like apple, banana, cherry.
Does it fix words split with a hyphen in PDF text?
Yes, when you tick Rejoin words split with a hyphen at the end of a line. para- at the end of a line followed by graph becomes paragraph.
Will removing line breaks change my words?
No. Only line breaks, and if you choose, spaces at the ends of lines and double spaces, are removed. Words and punctuation stay the same.
Does it work with Windows and Mac text?
Yes. Windows (CR LF), Mac and Linux (LF) and old Mac (CR) line breaks are all handled.
Is my text uploaded?
No. Everything runs in your browser and nothing you paste is sent or stored.
Sources and references
- Newline, Wikipedia
- Helpful search strings for finding special characters in Word, Microsoft TechNet
- How to remove carriage returns (line breaks) from cells in Excel, Ablebits
More text editing tools
- ␣ Remove Extra Spaces Remove double spaces, tabs, invisible spaces and extra blank lines. Open tool
- Count Line Counter Count total, blank and duplicate lines in text, lists, code or CSV. Open tool
- PDF PDF Word Counter Count words in a PDF with a page-by-page breakdown. Open tool
- A→B Find and Replace Find words or phrases and replace them all, with whole-word and regex options. Open tool