TinyFileLab

Home›Developer›Remove line breaks

Your text never leaves this page

Remove line breaks

Paste text that breaks at the end of every line and get clean paragraphs back. Lists stay as lists, blank lines stay as paragraph breaks, and nothing leaves your browser.

Your text
What to do with the breaks

Lines inside a paragraph are joined with a space. A blank line still separates paragraphs.

Result
Your text stays in the tabNothing is sent to a server, so drafts and client work stay private.
Paragraphs surviveWrapped lines are joined; blank lines between paragraphs are kept.
Rules you can seeLists, hyphens and sentence ends each have their own switch.

Why the breaks are there in the first place

Text copied out of a PDF, an old plain-text email or a terminal window usually arrives with a hard line break at the end of every visual line. The program that laid it out knew where each line ended on the page, and it wrote that down; what it did not write down is which of those breaks are real paragraph endings and which are just the edge of the column. Paste the result into a document or a form and you get a ragged column of half-lines that will not reflow.

The fix is not simply “delete every line break”, because that also destroys the paragraphs. The default mode here, Keep paragraphs, joins the lines within each paragraph with a single space and keeps the blank lines that separate one paragraph from the next. In most text copied from a PDF or an email, the blank line is the one reliable signal of a real paragraph break, so that is what the tool trusts.

The four modes

Keep paragraphs is the one to reach for first. Remove all joins everything into a single block, blank lines included, which is what you want for a field that only accepts one line, such as a spreadsheet cell or a form's summary box. Remove empty lines only is the opposite job: the line structure stays, but blank lines and lines holding nothing but spaces are taken out, which tidies up a list or a log with gaps in it. Replace with… turns every break into a string you choose, so a column of email addresses pasted from a spreadsheet can become a@x.com, b@y.com, c@z.com in one step.

Lists, sentence ends and hyphens

Joining lines blindly damages lists. With Keep list items on their own lines switched on, a line that starts with a bullet, a dash, an asterisk or a number or letter followed by a full stop or bracket (1., 2), a), iv.) keeps its own line, while any wrapped continuation of that item is still joined onto it.

Some text has no blank lines at all between paragraphs; each one simply ends with a full stop at the end of a line. Keep a break after . ? ! and : handles that case by keeping any break that follows sentence-ending punctuation. It is off by default because in ordinary wrapped prose a sentence often happens to end exactly at the end of a line, and those breaks would be kept where you did not want them.

Rejoin words split with a hyphen glues infor- and mation back into one word when a line ends in a letter followed by a hyphen and the next line starts with a lower-case letter. It is off by default for an honest reason: it cannot tell a word hyphenated for line-wrapping from a genuinely hyphenated word that happens to fall at the end of a line, so well- / known becomes wellknown. Turn it on for text copied from justified PDFs and books, where the first kind is far more common, and read the result. Soft hyphens, the invisible kind some programs insert, are always removed, because they only ever mark a split.

Line breaks you cannot see

A line break is not a single character. Windows writes carriage return plus line feed, older Mac software wrote a lone carriage return, Unix and the web use a line feed on its own, and Unicode adds its own line separator and paragraph separator characters, which turn up in text copied from some apps and PDF readers and which many simple find-and-replace tools miss. All of them are treated as line breaks here, which is why this can succeed where a search for \n in an editor finds nothing.

Collapse repeated spaces tidies up afterwards: runs of spaces and tabs become one space, and spaces left dangling at the start or end of a line are trimmed. Switch it off if the spacing inside your text is deliberate, such as aligned columns in code.

In Word, Excel and Google Docs

If you would rather do it in the program you are already in: in Word, Find and Replace with ^p (a paragraph mark) or ^l (a manual line break) in the search box removes them, though it cannot tell wrapped lines from real paragraphs, which is exactly the problem this page solves. In Excel, =SUBSTITUTE(A1,CHAR(10)," ") removes the line breaks inside a cell, and =CLEAN(A1) strips them along with other non-printing characters. Google Docs accepts the regular expression \n in Find and Replace when Use regular expressions is ticked.

Common questions

How do I remove line breaks but keep paragraphs?

Use the default Keep paragraphs mode. Lines within a paragraph are joined with a space and the blank lines between paragraphs are kept. If your text has no blank lines between paragraphs, switch on Keep a break after . ? ! and : so each paragraph's final line keeps its break.

Why does text copied from a PDF have a line break on every line?

Because a PDF records where each line sits on the page, not which lines belong to the same paragraph. When you copy, the reader turns every line end into a hard break. Pasting here and using Keep paragraphs undoes that for text where paragraphs are separated by a blank line.

Will it merge my bullet points into one line?

Not with Keep list items on their own lines switched on, which is the default. Lines that start with a bullet, a dash, an asterisk, or a number or letter followed by a full stop or bracket stay on their own line, and any wrapped continuation of an item is joined onto it.

Can I turn a column of names into a comma-separated list?

Yes. Choose Replace with… and type , (a comma and a space) in the box. Every line break becomes that separator and blank lines are dropped, so a pasted spreadsheet column becomes a single comma-separated line. Any other separator works the same way.

What about hyphenated words split across lines?

Tick Rejoin words split with a hyphen. It joins a line ending in a letter and a hyphen to a next line that starts in lower case. It is off by default because it will also join genuinely hyphenated words that fall at a line end, such as well-known, so check the result.

Does it handle Windows and Mac line endings?

Yes. Windows CRLF, old Mac CR, Unix LF, and the Unicode line separator and paragraph separator characters are all recognised as line breaks. The result uses plain LF line endings, which every modern program accepts.

Is my text sent anywhere?

No. Everything happens in this page as you type; nothing is uploaded, stored or logged. It keeps working with your network connection switched off, which matters when the text is an email, a contract or client work.

Is there a length limit?

No fixed limit. The result updates on every keystroke, and even a whole book's worth of text is processed in a fraction of a second on an ordinary computer. You can also drop a .txt file on the input box.