Remove Line Breaks from Text — Online Tool
Paste text with hard-wrapped or extra line breaks, choose how to replace them, and copy a clean continuous version in seconds.
0 characters · 0 lines
What line breaks are and why they end up in the wrong places
A line break is the character that starts a new line of text. On Unix and macOS systems it's a single newline (LF, U+000A); on Windows it's a carriage-return followed by a newline (CRLF, \r\n). Both produce the same visual result — text wraps to the next line — but they're stored differently, which is why some tools treat \r\n as two separate characters and strip only the \n.
The trouble starts when text from a source that hard-wraps its lines lands in a context that doesn't expect those breaks. PDF export splits each typeset line at the margin and inserts a break; paste that paragraph into a form field or a chat window and every sentence fractures mid-word. Plain-text emails wrap at 72 to 76 characters — a convention that dates to fixed-width terminals — and copy a long reply into anything modern and each line ends in the wrong place. Terminal output wraps at the window width. Spreadsheets sometimes store embedded newlines inside cells that survive the copy. In all these cases, the break was useful where it was created and becomes noise the moment it leaves.
How to use this tool
Paste your text into the input box. The character count and line count update immediately.
Choose what to do with line breaks: replace each one with a single space (the most common choice, which preserves word separation), or delete them entirely (useful when you want to concatenate fragments without adding gaps). Check "Merge extra spaces" to collapse any run of two or more spaces — including the ones the replacement may have created — down to one.
Press Remove Line Breaks. The output box fills with the processed text. Copy it with the Copy button, or clear both boxes with Clear and start again.
Before and after: four common inputs
PDF paragraph export: a three-line sentence like "The report covers\nquarterly results for\nall divisions." becomes "The report covers quarterly results for all divisions." — the breaks are replaced with spaces and nothing else changes.
Terminal output with a fixed-width wrap: a long command description printed at 80 columns has a break in the middle of a phrase. After removal with "replace with space", the phrase reads as one continuous sentence again.
Email reply with 72-character wrapping: a five-line paragraph becomes one line. If there were extra spaces left after the substitution — for instance, around a sentence-ending period followed by a break — "Merge extra spaces" collapses them.
Spreadsheet cell with embedded newlines: a cell exported to CSV or plain text may contain newlines where the original cell spanned multiple visual rows. Deleting the breaks entirely — rather than replacing them with spaces — joins the fragments without inserting gaps.
Six situations where removing line breaks saves time
Reformatting PDF text. PDF export inserts a hard break at the end of every typeset line, typically every 60 to 80 characters. Removing the breaks is almost always the first step in cleaning exported PDF prose before it goes anywhere else.
Cleaning up pasted emails. Quoted text in email threads is often wrapped at 72 characters. Paste it anywhere modern and every line ends in the wrong place, turning readable paragraphs into a series of short fragments.
Feeding text into AI prompts. A prompt that contains hard-wrapped text can confuse a language model into treating each line as a separate input. A single continuous paragraph gives the model better context for what you're asking.
Preparing text for spreadsheet import. A CSV field that contains embedded newlines will break the row structure of many parsers unless the breaks are removed beforehand or the field is properly quoted. Removing them avoids the problem entirely.
Cleaning up code comments or documentation. Docstrings and block comments are often formatted to 80 columns with hard wraps. When you move that text to a wiki, a README, or a ticket, those wraps become visual clutter that distracts from the content.
Fixing text copied from a chat log. Chat interfaces sometimes export conversation histories with a break after every short message. Run the export through this tool and the responses reassemble into readable paragraphs.
Four common mistakes when removing line breaks
Removing breaks from formatted lists. If your text has intentional line breaks — a bullet list, a numbered list, an address — removing all breaks will concatenate the items into a run-on string. Make a copy before you process, or select only the paragraph sections you want to join.
Forgetting \r\n on Windows. Text files created on Windows use a carriage-return plus newline pair. A tool that removes only \n leaves behind bare \r characters, which are invisible in most editors but occupy their own code point and break string comparisons and parsers. This tool removes both \r\n pairs and standalone \n.
Not merging the extra spaces. Replacing a line break with a space is correct when a break stands between two words. But if the original line ended with a space before the break, the substitution creates a double space. Turning on "Merge extra spaces" collapses all runs of multiple spaces back to one.
Expecting the tool to preserve paragraph spacing. This tool removes line breaks — it does not guess where one paragraph ends and another begins. If your source uses blank lines to separate paragraphs, those blank lines (two consecutive newlines) are also removed. Process one paragraph at a time if you need to keep paragraph boundaries intact.
Your text never leaves your browser
All processing runs as JavaScript in the page you're already looking at. Nothing is sent to a server, nothing is stored on your device after you close the tab. You can verify this by watching the network panel in your browser's developer tools while you press Remove Line Breaks — there will be no outgoing requests.
This matters if you're working with confidential content: contract text, client emails, internal documentation, or anything you wouldn't want uploaded to an unknown server. Browser-side processing means you keep full control throughout.
Related tools on this site
If your text also contains invisible Unicode characters — zero-width spaces, byte-order marks, soft hyphens — the invisible character remover handles those after you've cleaned up the line breaks.
For a full clean of AI text formatting residue in one pass, the clean AI text tool strips the invisible Unicode layer that AI interfaces add during copy.
If you also need to deal with em dashes in AI-generated text, the em dash remover on this site handles detection and replacement with options to substitute a comma, a space, or a regular hyphen.
For a broader look at what kinds of invisible characters might be hiding in pasted text, the zero width space remover page covers the six zero-width code points most commonly found in AI-generated content.
Frequently Asked Questions
▸What is the difference between \n and \r\n?
\n (LF, line feed, U+000A) is the standard line ending on Unix, Linux, and macOS. \r\n (CRLF) is the standard on Windows. Both produce the same visual result, but a tool that removes only \n from a Windows file leaves behind bare \r characters — invisible in most editors but genuinely different code points that can break string comparisons and file parsers. This tool handles both forms, so you don't need to know which one your source used.
▸Will removing line breaks join all my paragraphs into one block of text?
Yes, if there is nothing separating the paragraphs other than a single line break. Many sources use a blank line (two consecutive newlines) to mark paragraph boundaries, but this tool removes those too. A quick workaround: replace paragraph breaks with a unique placeholder first, run this tool, then restore the placeholders afterwards. For a document with a clear visual structure, processing one paragraph at a time also works well.
▸Can I use this to clean text copied from a PDF?
Yes — this is one of the most common uses. PDF export inserts a hard line break at the end of every typeset line, typically every 60 to 80 characters. Pasting the exported text and replacing breaks with spaces reconstructs the original flowing paragraphs. One caveat: if the PDF had hyphenated words at line boundaries — 'para-\ngraph' — the result will include a visible hyphen followed by a space. Those need to be edited by hand; the tool handles the breaks correctly, but the hyphenation is a separate issue.
▸What does 'Merge extra spaces' actually do?
It collapses any run of two or more consecutive space characters down to one, and trims leading and trailing spaces from the whole result. This matters after removing line breaks because the original text may have had a space at the end of a line immediately before the break. Replacing the break with a space then produces a double space. 'Merge extra spaces' catches all such runs — whether they came from the replacement operation or were already in the input — and normalises them.
▸Does this tool change my punctuation, capitalisation, or word order?
No. The tool removes or replaces line-break characters (\r, \n) and, optionally, collapses runs of spaces. It does not modify any other character: letters, digits, punctuation, accented characters, emoji, or any Unicode code point outside the line-break set are passed through unchanged. If the output looks different from what you expected, the most likely explanation is that a double space was collapsed, or that a line ended with a hyphen that is now visible between two words.
▸How do I remove line breaks from text in Excel?
In Excel, newlines inside a cell are stored as U+000A. The cell shows them as a visual line wrap, but they're real characters. To remove them: select the cells, open Find & Replace (Ctrl+H), put the cursor in the 'Find what' field and press Ctrl+J to enter a newline character, leave 'Replace with' empty, and click Replace All. For large volumes of text pasted from outside Excel, this online tool is faster — paste the raw text, process it, then paste the result back in.