Remove Line Breaks Online
Paste your text and choose how to clean it — remove all line breaks, strip extra blank lines, trim spaces, or remove empty lines. Free, instant, no signup.
When to use each option
- Remove all line breaks — joins everything into one continuous block. Use when pasting text into a field that doesn't support newlines (email subject, social post, spreadsheet cell).
- Remove extra blank lines — collapses 3+ blank lines to 1 blank line. Keeps paragraph structure but removes excessive spacing.
- Single line per paragraph — wraps each paragraph into one line, keeping blank lines between paragraphs. Useful for pasting into Markdown or CMS editors.
- Remove leading/trailing spaces — trims whitespace at the start and end of each line. Useful for cleaning up copied code or data.
- Remove extra spaces — collapses multiple consecutive spaces into one. Keeps line breaks intact.
- Remove blank lines — deletes all empty lines entirely. Useful for cleaning up code or lists.
Frequently asked questions
Why does copied text have so many line breaks?
PDFs, Word documents, and web pages encode line breaks at the end of every visual line. When you copy text, the line breaks come with it. This is especially common with PDFs — each line of text ends with a hard line break even mid-sentence. "Remove all line breaks" fixes this instantly.
How do I remove line breaks in Excel?
Excel cells can contain line breaks (Alt+Enter). To remove them: paste your cell content here, click "Remove all line breaks", copy the result, and paste back. Or use Excel's Find & Replace: Ctrl+H, in Find type Ctrl+J (represents a line break), leave Replace empty, click Replace All.
How do I remove line breaks in Google Docs?
Paste your text here, click "Remove all line breaks" or "Remove extra blank lines", copy the output, and paste back into Google Docs. Alternatively, use Google Docs Find & Replace (Ctrl+H) with regular expressions enabled and search for \n.
How do I remove line breaks from a PDF?
Copy text from the PDF (Ctrl+A to select all, Ctrl+C to copy), paste it here, and click "Remove all line breaks" or "Single line per paragraph" depending on whether you want to keep paragraph breaks. PDFs almost always have hard line breaks at every visual line end.
What is the difference between a line break and a paragraph break?
A line break (newline, \n) ends a line. A paragraph break is two consecutive newlines (\n\n) creating a blank line between paragraphs. "Remove extra blank lines" removes excess paragraph breaks while preserving one blank line between paragraphs. "Remove blank lines" removes all paragraph separators.
How do I remove line breaks in Word?
In Microsoft Word, use Find & Replace (Ctrl+H). In the Find field, type ^p for paragraph breaks or ^l for manual line breaks. Leave the Replace field empty and click Replace All. For a faster approach, paste your text here and click "Remove all line breaks" — no need to remember special codes.
How do I remove line breaks in Python?
Use the replace() method: text.replace('\n', '') removes all newlines. To replace with a space instead (to avoid words running together), use text.replace('\n', ' '). For Windows-style line endings, chain: text.replace('\r\n', ' ').replace('\n', ' ').
How do I remove newlines in JavaScript?
Use a regular expression with the global flag: str.replace(/\n/g, '') removes all newlines. To handle both Unix (\n) and Windows (\r\n) endings at once, use str.replace(/\r?\n/g, ''). Replace with ' ' instead of '' if you want words to stay separated.
How do I clean up copied PDF text?
PDF text almost always has hard line breaks at the end of every visual line, causing mid-sentence breaks when pasted. Paste the PDF text here and click "Remove all line breaks" to join it into continuous paragraphs. If the PDF has multiple sections, try "Single line per paragraph" to preserve section breaks while fixing mid-sentence splits.
What is the difference between \n and \r\n?
\n (LF, line feed) is the standard line ending on Unix, Linux, and macOS. \r\n (CRLF, carriage return + line feed) is the Windows standard. When text with \r\n endings is opened on a Mac or Linux system without conversion, you may see extra ^M characters or strange formatting. This tool handles both automatically.
How do I join lines in Notepad++?
Select the lines you want to join, then go to Edit → Line Operations → Join Lines. This merges the selected lines into one, removing the line breaks between them. For the entire document, select all (Ctrl+A) first, then use Join Lines. For more control over what separator to use between joined lines, paste the text here instead.
How do I remove blank lines in Vim?
In Vim normal mode, use the ex command :g/^$/d — this finds all lines matching the empty pattern (^$) and deletes them. To remove lines with only whitespace, use :g/^\s*$/d. If you're not a Vim user, paste the text here and click "Remove blank lines" for the same result.