What this tool does
A line break is the invisible character that ends a line and starts a new one. You add one each time you press Enter. Some text arrives with line breaks in the wrong places: every line copied from a PDF, quoted replies in old emails, text from a narrow web column, subtitles, or poems pasted into a field that should hold one line.
This tool removes those breaks and joins the lines back into normal sentences. You choose what replaces each break and whether paragraphs stay separate.
How to use it
- Paste your text into Text with line breaks.
- Under Replace line breaks with, choose A space, Nothing or A comma.
- Switch on Keep paragraph breaks if each paragraph should stay on its own line.
- Switch on Join words split by a hyphen for text from PDFs and books where long words were broken across lines.
- Remove double spaces is on by default, so lines that ended with a space do not leave a gap.
- Press Copy or Download to take the result.
The note under the tool says how many line breaks were removed.
Examples
Every result below came from this tool. The symbol ¶ marks a line break in the input column.
| Input | Setting | Result |
|---|---|---|
| Dear team, ¶ the meeting moved ¶ to Friday. | A space | Dear team, the meeting moved to Friday. |
| apple ¶ banana ¶ cherry | A comma | apple, banana, cherry |
| ABC ¶ 123 ¶ XYZ | Nothing | ABC123XYZ |
| The results were in- ¶ conclusive at first. | Join words split by a hyphen | The results were inconclusive at first. |
A longer case: the sample text on this page is two paragraphs copied from a PDF, seven lines in total. With default settings all six line breaks go and you get one long line. With Keep paragraph breaks switched on, four breaks are removed and the result is two clean paragraphs with a blank line between them:
This paragraph was copied from a PDF, so every line ends with a break that should not be there.
The second paragraph has the same problem.
How it works
The tool splits your text at every line break and trims spaces from the start and end of each line. Empty lines are dropped. The lines are then joined with the separator you picked. With Keep paragraph breaks on, the text is first split at blank lines, each paragraph is joined on its own, and the paragraphs are put back together with a blank line between them.
The hyphen option looks for a letter, a hyphen, a line break and then a lowercase letter. Only that pattern is joined, so “well-” at the end of a line followed by “Known” on the next stays as it is. A capital letter after the break usually means the hyphen is real.
Windows line endings (two characters) and old Mac line endings are handled the same way as normal ones.
Tips and limits
- Check hyphenated words. A compound such as “self-” and “employed” split over two lines will be joined as “selfemployed” when the hyphen option is on. Read through the result if your text has many hyphenated terms.
- Headings run into paragraphs. A PDF title with no full stop will join the first sentence. Add a full stop or a blank line after it before you paste.
- Lists lose their shape. Joining with a space is right for prose, not for bullet lists. For lists, A comma gives a neater result.
- Tabs and double spaces inside lines are not line breaks. Clean those with the whitespace remover.
Other ways to do it
Microsoft Word: open Find and Replace (Ctrl+H), type ^p in Find what and a space in Replace with, then press Replace All. To keep paragraphs, first replace ^p^p with a placeholder such as ###, then ^p with a space, then ### with ^p^p.
Excel and Google Sheets: for text inside one cell, =SUBSTITUTE(A1, CHAR(10), " ") replaces line breaks with spaces.
Code: in JavaScript, text.replace(/\s*\n\s*/g, ' ') does the basic job. In Python, ' '.join(text.split()) joins everything with single spaces.
Text copied from web pages often brings HTML tags or Markdown symbols with it. The text formatting remover strips those, and the plain text converter fixes curly quotes, fancy fonts and hidden characters.