How to Remove Line Breaks from Text
To remove line breaks, paste the text and read the result. With the default settings every line is joined to the next with a single space, blank lines are dropped, and spaces at the edges of each line are trimmed. This is the Example text after it goes through the tool:
The quick brown fox jumps over the lazy dog. This is the first paragraph of the sample. A second para- graph was split by a hyphen at the end of a line.The result is one block, which is what you want when a form field, a spreadsheet cell or a message box does not accept line breaks. Notice that the word para-graph is still split. That has its own option, described below.
Keep Paragraphs and Remove Only the Line Breaks Inside Them
Text copied from a PDF or an email is often wrapped at a fixed width. Every line ends with a break, even in the middle of a sentence, but the paragraphs are still separated by a blank line. Setting Remove to Keep paragraphs joins the wrapped lines and keeps the blank line between paragraphs. The Example text then becomes two paragraphs:
The quick brown fox jumps over the lazy dog. This is the first paragraph of the sample.
A second para- graph was split by a hyphen at the end of a line.A line that contains only spaces counts as blank, so it still separates two paragraphs. Several blank lines in a row are reduced to one. To only delete blank lines and keep every other line break, use Remove Empty Lines. To do the opposite and wrap long lines at a width such as 72 or 80, use Word Wrap.
Replace Line Breaks with a Space, Comma or Nothing
A space is the right choice for ordinary text. Other separators suit other jobs:
- Nothing: joins the lines with no gap. Use it for codes, IDs and keys that were wrapped, or for text that was split in the middle of a word.
- Comma and space: turns a list with one item per line into a single line, for example apple, banana, cherry.
- Semicolon and space, pipe or tab: for importing into tools that expect those separators.
A list of items joined this way can still have repeats. Remove Duplicate Lines cleans those up first. If you need the line breaks kept but written as the two characters backslash and n, for example inside JSON, use JSON Escape.
Fix Text Copied from a PDF, Email or Terminal
Three options help with wrapped text. Trim each line removes the spaces that some programs add at the end of a line, so they do not pile up after joining. Collapse extra spaces turns two or more spaces in a row into one. Join split words repairs hyphenation. If you want to tidy the spaces but keep every line where it is, including tabs and the non-breaking spaces that PDFs add, use the Space Remover instead.
Join split words works when a line ends with a letter followed by a hyphen and the next line starts with a lowercase letter. Then the hyphen and the break are removed, so para- and graph become paragraph. The rule is deliberately narrow. A line ending in a hyphen before a capital letter, such as Anglo- and Saxon, is left alone.
What Counts as a Line Break
Different systems end a line in different ways, and the tool treats all of them as line breaks:
- Line feed, written as LF or
\n: used by Linux, macOS and most web content. This is the one called new line. - Carriage return plus line feed, CRLF or
\r\n: used by Windows files. - Carriage return alone, CR or
\r: found in some older files. - Vertical tab and form feed: the form feed is the character behind many page breaks in plain text.
- The Unicode next line, line separator and paragraph separator characters.
So the tool can remove carriage returns, remove line feeds, remove the end of every line and remove page breaks from text in one step. If characters you cannot see are still left after the cleanup, the Invisible Character Remover lists them.
Removing Line Breaks in Word or Excel
You can paste the text from Word or Excel into this tool, remove the breaks and paste the result back. Both programs also have their own ways. In Word, Find and Replace can search for the paragraph mark, typed as ^p, and the manual line break, typed as ^l. In Excel, a formula such as =SUBSTITUTE(A2,CHAR(10)," ") replaces the line breaks in a cell with spaces. If you only need to change the case of a column, the Excel Case Converter works on whole files.
Limits and Things to Know
- The tool changes only line breaks and the spaces around them. It does not fix spelling, punctuation or capital letters.
- In All line breaks mode, blank lines are dropped and never create extra separators.
- Input is limited to 2,000,000 characters.
Your text is processed by code running in your browser. It is not sent to a server and not stored. See the Privacy Policy for details.