Remove Line Breaks
Strip or tidy line breaks in pasted text.
Everything runs in your browser. Nothing you type is uploaded or stored.
In-depth guide
Removing line breaks: four modes, what counts as a break
Join lines, unwrap paragraphs, collapse blank lines or delete empty lines, with computed examples and which characters count as a line break.
Key figures at a glance
- Modes
- Four
- Join everything, unwrap lines but keep paragraphs, collapse extra blank lines, remove blank lines.
- Recognised line breaks
- CR, LF, CRLF, VT, FF, U+0085, U+2028, U+2029
- All of them are turned into a line feed before the chosen mode runs.
- Join separator
- A single space
- Lines are trimmed first, so the seam never gets double spaces.
- Hyphenated words
- Not repaired
- A word split as final- / ized becomes final- ized.
The four modes
Every mode first converts \r\n, a lone \r, vertical tab, form feed, U+0085, U+2028 and U+2029 to \n, so Windows, Unix and old Mac text behave the same. The result updates as you type, in your browser.
| Mode | What it does |
|---|---|
| Join everything into one line | Trims each line, drops empty lines, joins the rest with one space. |
| Unwrap lines, keep paragraphs | Treats two or more consecutive newlines as a paragraph break (a line with only spaces or tabs counts as blank). Within each paragraph it trims, drops empty lines and joins with one space. Paragraphs are separated by exactly one blank line. |
| Collapse extra blank lines | Replaces three or more consecutive newlines by two. A line with only spaces or tabs counts as blank and is emptied. Nothing else changes: indentation and trailing spaces on text lines stay. |
| Remove blank lines | Deletes lines that are empty or only whitespace. Remaining lines keep their own indentation. |
Worked example
Input (with Windows line endings on the first three lines):
Dear team,
thank you for
your patience.
Next paragraph
line two
final-
ized
| Mode | Result (\n shows a newline) |
|---|---|
| Join everything | Dear team, thank you for your patience. Next paragraph line two final- ized |
| Unwrap, keep paragraphs | Dear team, thank you for your patience.\n\nNext paragraph line two\n\nfinal- ized |
| Collapse extra blank lines | Dear team,\n thank you for\nyour patience.\n\nNext paragraph \nline two\n\nfinal-\nized |
| Remove blank lines | Dear team,\n thank you for\nyour patience.\nNext paragraph \nline two\nfinal-\nized |
Note final- and ized are joined with a space: the tool does not know that the hyphen was a typesetting break. Join such words yourself.
Which characters count as a line break
Every break that Unicode defines as mandatory (UAX #14) counts: carriage return, line feed and their CRLF pair, vertical tab U+000B, form feed U+000C, next line U+0085, line separator U+2028 and paragraph separator U+2029. Text from other sources can contain them (U+2028 turns up in JSON and JavaScript strings, U+2029 in word processors). Each one is converted to a line feed first, so it is joined, unwrapped or removed like any other break. In a test, a, U+2028, b became a b in "join everything" mode.
Other invisible characters are not line breaks. If a result still looks odd, run it through the hidden character cleaner.
Trimming uses JavaScript's trim(), which also removes non-breaking spaces and other Unicode space characters at the ends of lines.
Edge cases
- Whitespace-only lines count as blank. In "Collapse extra blank lines" and "Unwrap lines, keep paragraphs", lines that hold only spaces or tabs are treated like empty lines:
a, a space-only line, another space-only line,bbecomesa, one empty line,b. Text lines keep their own trailing spaces. - Chinese, Japanese and Thai text. These scripts do not put spaces between words, but "join everything" still inserts one:
你好and世界on two lines become你好 世界. Remove the space afterwards if the lines were a single sentence. - Code and Markdown. Joining lines destroys indentation, lists and code blocks. "Remove blank lines" is the only mode that preserves each remaining line exactly.
- Poetry and addresses. Line breaks carry meaning; do not join.
Common mistakes
- Choosing "Join everything" for multi-paragraph text and losing the paragraph structure; use "Unwrap lines, keep paragraphs".
- Expecting Windows CRLF line endings to be kept. Every break is converted to a line feed, so the output uses LF only.
- Expecting hyphenated line-end words to be repaired.
- Forgetting trailing spaces: only the unwrap/join modes trim lines.
Related tools
Hidden character cleaner highlights and removes invisible characters. Text sorter and Comma separator handle one-item-per-line lists. Word counter counts lines and paragraphs. Text diff shows what changed.
Frequently asked questions
Is my text sent to a server?
No. Everything runs in your browser using JavaScript. Nothing you type or paste is uploaded, logged or stored anywhere.
Is there a length limit?
There is no fixed limit — the practical ceiling is your browser's memory. Documents of tens of thousands of words are handled comfortably.
Does it handle non-English text?
Yes, any language works because the tool only looks at line breaks. One caveat: when joining lines it puts a space between them, which suits English or Malay but not Chinese or Japanese, where you would need to delete those spaces afterwards.
Does it change my original text?
No. Your input stays exactly as you typed it; the result is produced separately so you can adjust the options and compare.
Sources
- Unicode UAX #14 — Line Breaking Algorithm — Lists CR, LF, NEL, VT, FF, U+2028 and U+2029 as separate line-break classes.
- MDN — String.prototype.trim()
This guide explains published rules in plain language. It is not financial, legal or official advice — rules change, so confirm with the agency linked above before you commit.