# Remove Line Breaks

URL: https://hifreetools.com/text/remove-line-breaks

> Paste text with hard line breaks and instantly join it into one continuous block, replacing every newline with a space, nothing, or your own separator.

## Quick answer

To remove line breaks, paste your text and the tool replaces every carriage return and line feed (CR, LF, and CRLF) with your chosen separator - a space by default, an empty string, or a custom character. "Collapse spaces" (on by default) merges the gaps left behind, and "keep paragraphs" preserves the blank-line breaks between paragraphs.

## Formula

- Join with separator: output = input with every CRLF, CR and LF replaced by separator
- Collapse spaces: if collapse is on: every run of spaces and tabs in output becomes a single space
- Keep paragraphs: if keep paragraphs is on: split on blank lines first, join breaks within each paragraph, rejoin paragraphs with a blank line

The tool normalizes all newline styles first: Windows CRLF (\r\n), classic Mac CR (\r), and Unix LF (\n) are each treated as a single line break. Every line break is then replaced with the separator you pick - a single space by default, an empty string to glue words together, or any custom text such as a comma or pipe. When "collapse multiple spaces" is on, runs of spaces and tabs left after joining are squeezed into one space so you do not get double spacing where lines met. When "keep paragraph breaks" is on, the text is first split on blank lines (two or more consecutive newlines) into paragraphs; line breaks inside each paragraph are replaced with the separator while the blank line between paragraphs is preserved as a double newline. All processing happens live in your browser as you type - nothing is uploaded.

## Examples

- Join two lines with a space: Hello World → Hello World
- Remove breaks with no separator: abc def ghi (separator = empty) → abcdefghi
- Collapse spaces after joining: one two three (separator = space, collapse on) → one two three
- Keep paragraph breaks: Line A Line B Line C Line D (separator = space, keep paragraphs on) → Line A Line B Line C Line D

## FAQ

**How do I remove line breaks but keep my paragraphs?**
Turn on the "keep paragraph breaks" option. The tool splits your text on blank lines into paragraphs, joins the wrapped lines inside each paragraph with your separator, and leaves the blank line between paragraphs intact so the structure is preserved.

**What is the difference between CR, LF and CRLF?**
LF (\n) is the Unix/Mac line break, CR (\r) is the classic Mac break, and CRLF (\r\n) is the Windows break. This tool treats each of the three as a single line break, so pasting Windows text never leaves a leftover carriage return.

**How do I join lines without adding any space?**
Set the separator to empty (the "nothing" option). Each line break is deleted and the lines are concatenated directly, so "abc\ndef" becomes "abcdef".

**Can I replace line breaks with a comma or other character?**
Yes. Choose the custom separator option and type any text - a comma, comma-space, pipe, or word. Every line break is replaced with exactly that string, which is handy for turning a vertical list into a delimited one.

**Why do I get double spaces after removing line breaks?**
If a line ended with a trailing space and you replace the break with another space, the two spaces sit next to each other. Enable "collapse multiple spaces" and every run of spaces and tabs becomes a single space.

**Is my text uploaded to a server?**
No. All processing runs entirely in your browser with JavaScript. Your text never leaves your device, so it is safe to paste private or sensitive content.


## Sources

- [MDN - String.prototype.replace()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)
- [Wikipedia - Newline](https://en.wikipedia.org/wiki/Newline)

Runs in the browser; nothing is uploaded. Cite as: HIFreeTools, "Remove Line Breaks", https://hifreetools.com/text/remove-line-breaks
