How to Remove Line Breaks
By Tools Star Hub Editorial Team · Published · Updated
To remove line breaks, paste the text and choose what should happen to each break. Replace line breaks with spaces turns Hello and world on two lines into Hello world. Remove line breaks joins them into Helloworld. Keep paragraph breaks leaves a blank line between paragraphs and joins the lines inside each paragraph with spaces. An empty box is rejected.
Copied paragraphs often arrive with a break after every line. That is hard to edit and it inflates a line count. Joining lines, or joining only the lines inside a paragraph, makes the text readable again without retyping it. The change stays in the browser.
Which of the three modes should you use?
Replace line breaks with spaces is the usual choice for a wrapped paragraph. Every run of line breaks becomes one space, repeated spaces and tabs collapse, and the result is trimmed. Hello followed by a line break and world becomes Hello world.
Remove line breaks deletes the breaks and does not insert a space. Hello and world become Helloworld. Use that only when the break was not standing in for a space, such as a word split across two lines with no hyphen you want to keep.
Keep paragraph breaks splits the text on a blank line, which is two or more line breaks. Inside each block, single breaks become spaces. The blocks are joined again with a blank line. A single break inside a paragraph is not kept as its own line.
What counts as a line break?
Windows line endings, old Mac carriage returns, and ordinary newline characters are all treated as line breaks before the mode runs. You do not pick a line-ending style. The page normalizes them first.
Spaces that were already between words stay. The space mode also collapses runs of spaces and tabs that appear after the breaks are replaced. It does not delete a single space between words.
What should you check after the join?
Read the joins. A line that ended with a hyphen may now contain a hyphen in the middle of a sentence. A list that used one item per line becomes one sentence in the space mode. If you needed the list, do not use that mode.
Empty input fails with Paste some text first. Whitespace alone is also empty after trimming. The page does not invent a paragraph. If you also need a character count, count the text after you join it, because the breaks themselves are characters.
How to remove line breaks
- Paste the text. The box cannot be blank. A file that is only line breaks is treated as empty.
- Pick a mode. Use spaces for wrapped prose, remove when you truly want the characters pushed together, and paragraph mode when blank lines should stay.
- Run it and read the joins. Look for missing spaces, leftover hyphens, and lists that collapsed into one line.
- Copy the result. The original stays in the box until you clear it. Copy only the output you checked.
Example
Two words on two lines
Hello followed by a newline and world becomes Hello world in the space mode. The remove mode returns Helloworld, with no space added.
A blank line between paragraphs
Keep paragraph breaks leaves the blank line between two blocks and joins any single line breaks inside each block with spaces. One trailing blank line does not create an extra empty paragraph.
Common mistakes
Remove is not the same as replace with spaces
Remove deletes the break. It does not put a space where the break was. Words that sat on separate lines will stick together.
A list is a list of lines
The space mode turns one item per line into one paragraph. Keep the breaks if the line structure matters.
FAQ
- What does Hello on two lines become?
- With Replace line breaks with spaces, Hello and world become Hello world. With Remove line breaks, they become Helloworld.
- Does a blank line survive?
- Only in Keep paragraph breaks. That mode splits on two or more line breaks and joins the pieces with a blank line. The other two modes do not keep paragraph gaps.
- Why does an empty box fail?
- The page asks you to paste some text first. A box that is only spaces or line breaks is empty after trimming.
- Are Windows line endings handled?
- Yes. Carriage return plus newline, a lone carriage return, and a newline are all treated as line breaks before the mode runs.
- Does the text leave the browser?
- No. The line-break tool rewrites the text in this tab.
To join lines, drop breaks, or keep paragraph gaps, use the Remove Line Breaks tool. It runs in the browser.
For duplicate lines, whitespace, and a side-by-side comparison, read How to clean and compare text.
To see how breaks affect a count, see How to count characters.