Remove line breaks from text

Remove line breaks from text by joining every line into one stream with the separator you pick. Choose a space, a comma, a pipe, nothing at all, or type your own custom separator. Optional toggles trim each piece before it joins, drop blank lines, or leave a single line break instead of removing all of them. The transform runs in your browser. To go back the other way, use commas to newlines.

Input
Line 1:1 LF cloud_done Saved locally
Result Remove Line Breaks
0 lines 0 chars

How line-break removal works

The default split treats any run of \n or \r\n as one boundary, so a\n\nb still becomes a, b rather than a, , b. Each piece between runs is then concatenated with your chosen separator. The Replace with dropdown maps to " " for space, ", " for comma, " | " for pipe, an empty string for nothing, or whatever you typed in the Custom field.

Three toggles modify the join. Trim Parts strips leading and trailing whitespace from each line before it joins, useful when source lines have indentation you want to drop. Drop Blank filters out lines that are empty or whitespace-only, so they do not contribute an extra separator. Collapse Runs switches the operation: instead of joining with a separator, it leaves a single \n between lines, collapsing every run of multiple breaks down to one.

Output is computed in JavaScript on every keystroke. No upload, no server round trip. Pair this with remove blank lines if you want a plain compact list, or newlines to commas for the most common shorthand.

How to use remove line breaks from text

  1. 1Paste your multi-line text into the input panel on the left.
  2. 2Pick a separator from the Replace with dropdown.
  3. 3For a custom string, switch to Custom and type it into the field below.
  4. 4Toggle Trim Parts or Drop Blank to clean each piece before joining.
  5. 5Click Copy on the output panel to grab the joined result.

Keyboard shortcuts

Drive TextResult without touching the mouse.

Shortcut Action
Ctrl FOpen the find & replace panel inside the input Plus
Ctrl ZUndo the last input change
Ctrl Shift ZRedo
Ctrl Shift EnterToggle fullscreen focus on the editor Plus
EscClose find & replace, or exit fullscreen
Ctrl KOpen the command palette to jump to any tool Plus
Ctrl SSave current workflow draft Plus
Ctrl PRun a saved workflow Plus

What this tool actually does

Five separator presets plus custom

The Replace with dropdown offers Space, Nothing, Comma, Pipe, and Custom. Comma uses ", " with a trailing space, pipe uses " | " for readability. Custom takes any string you type, including multi-character separators like ; or -> .

Handles LF and CRLF the same

The split regex matches both \n (Unix) and \r\n (Windows) so the result is identical regardless of how your source file was saved. The input status bar shows the detected line ending so you can verify which one came in.

Optional per-line trim

Flip Trim Parts on to call String.prototype.trim() on each piece before joining. That cleans up indented source code, leading bullets after splitting, or trailing tabs. Leave it off if your separator should be applied to lines verbatim.

Drop blank lines from the join

Flip Drop Blank on to filter out lines that are empty or contain only whitespace. Without this, two blank lines between paragraphs would inject extra separators. With it on, blank lines vanish before the join.

Keep one break instead of removing all

Flip Collapse Runs on to switch the operation: every run of consecutive line breaks collapses to a single \n, and the chosen separator is ignored. Useful when you want to flatten double-spaced paragraphs without joining them onto one line.

Worked example

With Replace with set to Comma, runs of newlines collapse to one separator so the empty row does not produce a phantom comma.

Input
First line
Second line
Third line

Final line
Output
First line, Second line, Third line, Final line

Settings reference

Setting or behaviour Effect on output
Replace with: Space Joins lines with a single ASCII space.
Replace with: Nothing Joins lines with an empty string. Use to glue OCR fragments back together.
Replace with: Comma Joins with ", " (comma + space).
Replace with: Pipe Joins with " | " (space, pipe, space) for human readable lists.
Replace with: Custom Uses the exact string from the Custom field, including leading or trailing spaces.
Custom field Active only when Replace with is Custom. Empty custom = empty separator.
Collapse Runs toggle When on, every run of breaks collapses to a single \n and the separator is ignored.
Trim Parts toggle When on, each line is trimmed before joining.
Drop Blank toggle When on, lines that are empty or whitespace-only are dropped before joining.
Runs of consecutive newlines Treated as one boundary by default, so blank rows do not double the separator.

FAQ

How do I use a custom separator?
Set Replace with to Custom, then type the exact string you want into the Custom field below. Any text works, including multi-character strings like ; or -> . Leading and trailing spaces in the custom field are preserved.
Will this remove blank lines too?
Only if you turn on Drop Blank. By default, runs of newlines are treated as one boundary, so a blank row between paragraphs does not produce a doubled separator. Turn Drop Blank on to also strip whitespace-only lines.
Does it work on Windows-style line endings?
Yes. The split handles both \n and \r\n, so a CRLF file from Windows produces the same output as an LF file from macOS or Linux. The input status bar shows which line ending was detected.
How is this different from remove all whitespace?
Remove all whitespace deletes every space, tab, and newline. This tool only joins lines, leaving spaces and tabs inside each line alone. Use this when you want one paragraph with words still spaced normally.
Is the result available offline?
Yes. The transform is a JavaScript split-and-join evaluated in your browser. After the page loads, no network call is needed, and nothing is sent back to the server when you type or paste.