LTLine Toolkit

Tools / Remove line breaks

Remove Line Breaks

Join broken lines into one paragraph. Collapses the line breaks and the double spaces that copied text usually brings with it.

Everything runs in your browser. Your text is never uploaded or stored.

How it works

Text copied out of a PDF, an email or a narrow column arrives hard-wrapped: a line break in the middle of every sentence. Pasting that into a document leaves ragged lines, and pasting it into a form field leaves stray breaks that some systems turn into garbage characters.

This tool replaces each line break with a space and then collapses the runs of spaces that result, so you do not get a double space where a break met an existing space. If your source has real paragraph breaks separated by a blank line, tick the paragraph option: those gaps are kept while the wrapping inside each paragraph is still joined. That is the difference between reflowing one paragraph and losing your document structure.

Edge cases

Do it in code instead

The same result with a shell one-liner or a few lines of Python, if you would rather automate it:

Bash (tr)

tr '\n' ' ' < wrapped.txt

Python

import re
t = open('wrapped.txt').read()
print(re.sub(r'\s*\n\s*', ' ', t).strip())

JavaScript

text.replace(/\s*\n\s*/g, ' ').replace(/[ \t]{2,}/g, ' ').trim();

Excel

=SUBSTITUTE(A1,CHAR(10)," ")

Questions

Does it keep my paragraphs?
Tick “keep blank-line paragraph breaks”. A blank line is treated as a paragraph boundary and kept, while the wrapped lines inside each paragraph are joined into flowing text.
Why are there still two spaces?
Repeated spaces inside a line are collapsed, but a non-breaking space is not an ordinary space and may survive. Replace it explicitly if your source came from a web page.
Will it fix words split across lines?
No. If a word was hyphenated at the end of a line, joining the lines leaves the hyphen and produces something like inter- national. Repair those by hand or with a targeted replace, because an automatic fix would also damage real hyphens.

Last verified: 2026-12-04