Home  /  Guides  /  Remove line breaks

How to Remove Line Breaks From Copied Text (Without Losing Paragraphs)

Updated 2026-10-13  ·  7 min read

Copy a paragraph out of a PDF and you get a document that looks like a poem: every visual line has become a real line break, so the text reflows into a ragged column the moment you paste it anywhere narrower. The problem is that the breaks you want to delete and the breaks you want to keep look identical on screen. Here is how to tell them apart and remove only the ones you do not need.

Advertisement

Hard breaks and soft breaks

A soft break is a visual convenience. Your editor wraps a long line to fit the window, and if you resize the window the wrap point moves. It is not a character and nothing is inserted into the text.

A hard break is a real character in the file. It was inserted deliberately, by a person pressing enter or by a program writing a line ending. It travels with the text when you copy it, and it is what makes pasted PDF text look broken.

Every word processor has a mode that displays hard breaks as visible marks, and turning it on is the fastest way to see which one you are dealing with.

How to tell which ones you have

  • Turn on formatting marks, called paragraph marks in most editors, and hard breaks appear as a pilcrow or arrow symbol
  • Click at the end of a line and press End. If the cursor jumps to the next line, there is a hard break there
  • Paste into a plain text editor. Hard breaks survive, soft wraps do not
  • Paste into a browser text counter. The word count is usually unaffected, but the character count will be noticeably higher than expected if hard breaks came along

The rule that solves it

Single line breaks become spaces. Double line breaks stay. The logic is that a PDF or a quoted email inserts a break at every visual line, which is always a single break, while a genuine paragraph boundary is almost always rendered as a blank line, which is a double break.

Apply that rule and the integrity of your paragraphs survives while the artificial breaks disappear. Apply a blanket removal instead and you will join every paragraph into one enormous block, which is much harder to reverse than it was to create.

Doing it in a word processor

The naive approach is to search for the paragraph mark and replace it with a space, which removes every break including the ones that mattered. The better approach uses a pattern that only matches a break between two lowercase letters, which is the signature of a line wrapped mid sentence.

  • In Word, use find and replace with regular expressions enabled, and replace a lowercase letter followed by a paragraph mark followed by a lowercase letter, keeping both letters and inserting a space between them
  • In Google Docs, the same approach works with regular expressions enabled in find and replace
  • Work in a duplicate of the document, because a replacement applied to a hundred breaks by accident takes far longer to undo than to prevent

Doing it in a browser

A browser tool is faster than a regex when you do not need the pattern, and it has one real advantage: nothing is uploaded. Well built formatters run entirely in JavaScript in your page, so confidential text never leaves your machine.

The workflow is to paste, apply the single and double break distinction, then copy the cleaned result back to wherever it came from.

When to remove every break instead

There are cases where you genuinely want one continuous string with no breaks at all.

  • Pasting a multi line address or paragraph into a single line form field
  • Preparing text for a spreadsheet cell, where line breaks make the value awkward to sort
  • Preparing text for a JSON string, where a literal line break is invalid
  • Preparing text for a command line argument or a search query

Checking the result

After cleanup, count the text again. The count you had before cleanup was inflated by breaks that were never part of the prose, and it is worth knowing the real figure before you submit it anywhere.

Frequently asked questions

How do I remove line breaks from text copied out of a PDF?
Replace single line breaks with a space and leave double line breaks alone. The singles are artifacts of the PDF layout at every visual line end, while the doubles are genuine paragraph boundaries.
Why did removing line breaks merge all my paragraphs?
Because every break was treated the same way. A paragraph boundary is normally a double break, so a blanket replacement joins the paragraphs. Work on a copy, and keep double breaks.
Can I see where the hard line breaks are?
Yes. Turn on formatting marks in your editor and they appear as small symbols at the end of each line. That is the quickest way to distinguish real breaks from visual wrapping.
Does removing line breaks change the word count?
It can change the character count noticeably, since each break was a character. The word count usually stays the same or drops slightly, because breaks between two words were acting as separators anyway.