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
- 1Paste your multi-line text into the input panel on the left.
- 2Pick a separator from the Replace with dropdown.
- 3For a custom string, switch to Custom and type it into the field below.
- 4Toggle Trim Parts or Drop Blank to clean each piece before joining.
- 5Click Copy on the output panel to grab the joined result.
Keyboard shortcuts
Drive TextResult without touching the mouse.
| Shortcut | Action |
|---|---|
| Ctrl F | Open the find & replace panel inside the input Plus |
| Ctrl Z | Undo the last input change |
| Ctrl Shift Z | Redo |
| Ctrl Shift Enter | Toggle fullscreen focus on the editor Plus |
| Esc | Close find & replace, or exit fullscreen |
| Ctrl K | Open the command palette to jump to any tool Plus |
| Ctrl S | Save current workflow draft Plus |
| Ctrl P | Run 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.
First line Second line Third line Final line
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?
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?
Does it work on Windows-style line endings?
\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.