Remove Line Breaks
Free online remove line breaks. Strip line breaks, extra spaces, clean text. No sign-up, works in your browser.
Embed this tool
Copy and paste the code below into your website to embed this tool for free. An attribution link to The Util Box is required.
<iframe src="https://www.theutilbox.org/embed/remove-line-breaks" width="600" height="500" frameborder="0" style="border: none; max-width: 100%;" title="Free Remove Line Breaks tool from The Util Box"></iframe> <!-- Free tool by The Util Box — https://www.theutilbox.org/tools/remove-line-breaks --> <a href="https://www.theutilbox.org/tools/remove-line-breaks">Remove Line Breaks by The Util Box</a>
Frequently Asked Questions about Remove Line Breaks
Remove Line Breaks — Fix Text That Wrapped Itself
This tool strips newlines from your text and joins it back into a single flowing line. It exists for one very common problem: text that was hard-wrapped somewhere, or copied out of a PDF, email or fixed-width field, now breaks awkwardly and blows a character limit you did not expect to hit.
You choose what replaces each line break — a single space by default, which is right for prose. Setting it to nothing produces a joined-up mess, which is occasionally what you want for a URL or a code fragment but rarely what you want for a paragraph. There is also a toggle to collapse runs of multiple spaces afterwards.
What It Actually Does, Precisely
Two transformations run, in order, and both are worth understanding because they determine whether you get the result you expected:
- Every newline is replaced. Both Windows-style
and Unix-styleline endings are handled, so pasting from either platform works identically. - Optionally, whitespace is collapsed. With "Remove extra spaces" on, any run of two or more whitespace characters becomes a single space, and the result is trimmed at both ends. This is the option that fixes three blank lines, not just one.
The order matters. Line breaks are replaced first, and only then is whitespace collapsed — so with a space as the replacement you never end up with a doubled space at the seam, which is the usual artefact of naive find-and- replace. Turning off the extra-spaces step leaves those seams alone, which is what you want if the line breaks were deliberate and you only meant to remove the odd one.
Where Broken Wrapping Comes From
- Copying from a PDF. The most frequent cause by a wide margin. PDFs store text as positioned glyphs, so the line breaks you see are layout artefacts of the page, not part of the content. This is why a paragraph lifted from a paper arrives as a dozen short lines.
- Fixed-width database fields. A column set to 50 characters inserts a newline every 50 characters regardless of word boundaries, so words are often split mid-syllable.
- Email and forum quoting. Each reply level is prefixed with
>characters, and the whole quoted history arrives inside what should have been a single field. - Plain-text formats. CSV, JSON and log files are often displayed with wrapping added by the viewer rather than present in the file.
- Word processors configured to hard-wrap. Documents set to wrap at a fixed column for printing or for encoding into a narrow field.
Before and After
| Input | Output (replacement = space, collapse on) |
|---|---|
| The quick brown fox jumps over the lazy dog |
The quick brown fox jumps over the lazy dog |
| Line one Line two |
Line one Line two |
| word1 word2 |
word1 word2 |
| Trailing spaces here |
Trailing spaces here |
Notice the third row. When a line break splits a single word across two lines, joining with a space produces
word1 word2 rather than word1word2. That is
usually correct for prose and wrong for data lifted from a narrow fixed-width field, where the line break fell
mid-token. If you are cleaning CSV-like data, set the replacement to nothing instead.
Related Cleanup Tools
- Character Counter — confirm the cleaned text now fits the limit, including the check for hidden characters.
- Invisible Character Finder — remove zero-width and non-breaking characters that survive this step and quietly break URLs and searches.
- Punctuation Fixer — clean up spacing and doubled punctuation after the joins.
- Text Diff Checker — confirm the change was only whitespace, by comparing the two versions.
- Case Converter — normalise the capitalisation of the result.
- Reverse Text — the other direction, for checking palindromes and similar patterns.
All text processing runs locally in your browser. Nothing is uploaded, which makes it safe for unpublished documents and confidential copy.