How to Fix Broken Line Breaks and Extra Spaces in Copied Text

Why text copied from PDFs, emails and websites breaks mid-sentence or fills with double spaces, and how to clean it without losing paragraph breaks.

Updated September 29, 2026 6 min read

Use the free Remove Extra SpacesClean double spaces, tabs and broken line breaks

You copy a paragraph from a PDF report and paste it into an email. Instead of flowing text you get short lines that break in the middle of sentences, random double spaces and a few lines that start with a tab. Or you paste a web page quote into a form and it refuses to fit because of invisible characters you cannot see.

This guide explains where that mess comes from, the difference between the invisible characters involved, and how to clean text quickly without destroying the paragraph structure you want to keep. It also covers the built-in methods in Word and on the command line.

Why copied text breaks

PDFs store lines, not paragraphs

A PDF describes where each line of text sits on the page. It usually has no concept of a paragraph that should reflow. When you copy, many PDF viewers insert a hard line break at the end of every visual line. Pasted into a wider window, those breaks remain, so sentences stop halfway across the screen.

Emails and plain-text wrapping

Some email programs wrap plain-text messages at a fixed width, often around 72 to 78 characters, by inserting real line breaks. Quoting and forwarding adds more, sometimes with > markers.

Spaces used for layout

Documents often use several spaces or tabs to line things up, and justified or column layouts can produce extra spaces between words when copied.

Invisible characters

Some characters look like a space, or like nothing at all:

Character What it is Where it comes from
Regular space The normal space Typing
Tab A jump to the next tab stop Word processors, spreadsheets
Non-breaking space A space that prevents a line break Web pages ( ), word processors
Zero-width space An invisible break opportunity Web pages, some apps, copy-paste from chat
Byte order mark An invisible marker at the start of a file Text files saved by some editors

These characters are why "identical" text can fail comparisons, why a search does not find a phrase that is clearly there, and why a character count is higher than expected.

Clean text in your browser

Our Remove Extra Spaces tool fixes all of the above and shows how much it removed.

  1. Open Remove Extra Spaces.
  2. Paste your text into Messy text. Click Sample to see a typical PDF paste first.
  3. Choose the switches:
    • Trim each line: removes spaces at the start and end of lines.
    • Collapse multiple spaces: turns runs of spaces into one, converts non-breaking spaces to normal spaces and deletes zero-width characters.
    • Replace tabs with a space.
    • Remove empty lines: deletes blank lines.
  4. Choose how to handle Line breaks:
    • Keep line breaks leaves the line structure alone.
    • Join lines, keep paragraphs (fix PDF copy-paste) joins the lines inside each paragraph into one flowing line, while keeping blank-line gaps between paragraphs.
    • Remove all line breaks (one paragraph) joins everything into a single block.
  5. Copy the result from Clean text or download it as a .txt file.

The table below the text compares Characters, Spaces & tabs and Lines before and after, with the number removed. It is a quick sanity check: if the line count drops from 60 to 4, you have joined broken lines into four paragraphs.

Choosing the right line-break option

  • For PDF text with paragraphs separated by blank lines, choose Join lines, keep paragraphs.
  • For lists, addresses or poetry, choose Keep line breaks, otherwise every item will merge into one line.
  • For a single field such as a meta description, bio or form field that does not accept line breaks, choose Remove all line breaks.

If a PDF paste has no blank lines between paragraphs at all, Join lines, keep paragraphs will produce one long paragraph. Add blank lines where paragraphs should start, then run it again.

Other ways to clean text

Microsoft Word

Word's Find and Replace (Ctrl+H) understands special codes. Search for ^p (paragraph mark) to find line breaks and ^t for tabs. A common routine for PDF text is:

  1. Replace ^p^p with a temporary marker such as ##.
  2. Replace ^p with a space.
  3. Replace ## with ^p^p.

Replacing two spaces with one, repeated until nothing is found, removes double spaces. This works well when the text is already in Word, although it takes several passes.

Plain-text editors and the command line

Many code editors can trim trailing whitespace and search with regular expressions. On macOS and Linux, tr -s ' ' squeezes repeated spaces, and tr '\n' ' ' turns all line breaks into spaces. For custom patterns, a regular expression replacement in Find and Replace gives you full control, for example replacing \s+ with a single space.

Pasting without formatting

Many apps support Ctrl+Shift+V (Cmd+Shift+Option+V on some Mac apps) to paste as plain text. That removes fonts and colours, but not broken line breaks or extra spaces, so it complements a cleaning tool rather than replacing it.

Pitfalls to watch for

Words hyphenated at line ends

PDFs often split long words across lines with a hyphen: "informa-" at the end of one line, "tion" on the next. Joining lines produces "informa- tion". Search for a hyphen followed by a space and fix these by hand, because an automatic fix would also break genuine phrases such as "long- and short-term".

Headings merging into paragraphs

If a heading sits directly above its paragraph with no blank line, joining lines will merge them. Add a blank line after each heading first.

Code and tables

Indentation is meaningful in code, and spacing aligns columns in plain-text tables. Don't collapse spaces in those; keep line breaks and turn off trimming.

Checking length afterwards

Cleaning can remove dozens of characters. If you are fitting text into a limit, check the final result with the Character Counter. And if the text came from a PDF you can open, our guide on copying text from a PDF covers getting a cleaner copy in the first place.

For finer control over only the line breaks, such as joining lines inside sentences while respecting lists, Remove Line Breaks is the specialised tool; for smart quotes, odd dashes and other typographic clean-up, use the Text Cleaner.

Frequently asked questions

How do I remove line breaks but keep paragraphs?

Make sure paragraphs are separated by a blank line, then choose Join lines, keep paragraphs. Lines inside each paragraph are joined with spaces and the blank lines between paragraphs remain.

What is a non-breaking space?

It is a space character that stops a line from breaking between two words, often used in web pages as  . It looks like a normal space but is a different character, so it can break searches and comparisons. The Collapse multiple spaces option converts it to a normal space.

Why does my text have double spaces after full stops?

Some people were taught to type two spaces after a sentence, and some documents contain them for justification. Collapse multiple spaces reduces them to one.

Will cleaning text change my words?

No. The tool only changes spaces, tabs, line breaks and invisible characters. Letters, numbers and punctuation stay exactly as they were.

Can I remove all line breaks at once?

Yes. Choose Remove all line breaks (one paragraph) and every line is joined into a single paragraph separated by spaces.

Try it now: Remove Extra Spaces

Loading tool…