How to Clean Up Copied Text: Remove Extra Spaces, Line Breaks, and Weird Formatting

If you need to know how to clean up copied text remove extra spaces first, because that is the mess you can see — but the real job is bigger than double spaces. Text pasted from a PDF, a website, or an email usually arrives with broken line breaks, stray tabs, odd characters, and formatting that fights your document. This guide shows how to fix each problem, in Word, in Google Docs, and with a free online tool that does it in one click.

The fastest route for a block of plain text is the Text Cleaner: paste the messy text in, and it strips the extra spaces, fixes the line breaks, and hands back clean text. Read on for the Word and Google Docs fixes.

Stressed man throwing documents in frustration at a wooden desk

Why Copied Text Comes Out Messy (PDFs, Websites, Emails)

Copy and paste looks like it moves text, but it actually moves a package: the words plus a bundle of formatting instructions and invisible characters from the source. When the destination cannot use those instructions, you get the mess.

PDFs are the worst offenders. A PDF does not store paragraphs; it stores lines of text placed at exact positions on a page. When you copy from a PDF, every visual line ends with a line break, so a paragraph that looked fine on the page pastes as a dozen short lines. PDFs also drop spaces where a line wrapped and join words that were hyphenated across lines. A paragraph copied from a PDF can look like this:

The quick brown fox jumps over
the lazy dog. The dog was not
amused.

Those line breaks are real characters in the pasted text, not just how it displays. If you paste that into a document with a different width, the breaks stay where they were and the text looks ragged.

Websites paste with their formatting attached: fonts, sizes, colours, background shading, and link styles. Paste a paragraph from a news site into Word and it often arrives in the site’s font at the site’s size, with a grey background behind it. Some sites also add extra blank lines between paragraphs, or put each list item on its own line with a tab in front of it.

Emails bring their own quirks: quoted text marked with > at the start of each line, hard line breaks from plain-text mail, and signature blocks full of phone numbers and disclaimers.

The single best habit is to paste without formatting in the first place. In most apps, Ctrl + Shift + V pastes plain text only — no fonts, no colours, no background. In Word, you can also use Paste Special > Unformatted Text, or click the clipboard icon that appears after pasting and choose Keep Text Only. It does not fix broken line breaks, but it stops the formatting half of the mess before it starts.

Remove Extra Spaces and Double Spaces

If you searched for how to clean up copied text remove extra spaces, this is the section you came for. Double spaces are the most common problem, and the easiest to fix. They creep in from old typing habits (two spaces after a full stop), from PDFs that add a space at the end of each line, and from copy-and-paste joining words with a space on both sides.

In Word: press Ctrl + H to open Find and Replace. In Find what, press the spacebar twice. In Replace with, press it once. Click Replace All. Then click Replace All again — one pass turns a run of four spaces into two, so you need to repeat until Word reports no more replacements.

In Google Docs: press Ctrl + H, tick Match using regular expressions, search for + (a space followed by a plus sign, which means “one or more spaces”) and replace with a single space. One pass handles runs of any length.

Online: paste the text into the Text Cleaner and it collapses every run of spaces into one, including tabs used as spacing.

Before you fix spaces, it helps to see them. In Word, click the button on the Home tab (or press Ctrl + Shift + 8) to show formatting marks: every space becomes a dot, every paragraph mark becomes a ¶, and tabs become arrows.

Fix Broken Line Breaks and Paragraphs

This is the PDF problem: a paragraph pasted as a stack of short lines. The fix depends on whether the breaks are paragraph marks or manual line breaks, and Word treats them differently.

A paragraph mark (¶) is what you get when you press Enter. A manual line break is what you get with Shift + Enter, and it is what many PDFs produce when you copy text. In Find and Replace, Word uses codes for these: ^p for a paragraph mark and ^l (a lowercase L) for a manual line break.

To join lines that were one paragraph: if the text has a line break at the end of every line and a blank line between paragraphs, first replace the double breaks with a marker, then replace the single breaks with spaces, then put the paragraph breaks back. In Word, with Find and Replace open:

  1. Find ^p^p, replace with a marker such as @@@, Replace All. (This protects the real paragraph gaps.)
  2. Find ^p, replace with a single space, Replace All. (This joins the broken lines.)
  3. Find @@@, replace with ^p, Replace All. (This restores the paragraph gaps.)

If the breaks are manual line breaks instead, use ^l in place of ^p in step 2. And never replace a single ^p with nothing across a whole document — that joins every heading, list item, and paragraph into one solid block of text. Always work on the doubled code first, or select only the text you want to fix before you run Replace All.

To remove blank lines: find ^p^p and replace with ^p, then click Replace All repeatedly until Word finds nothing more. Each pass halves the run of empty paragraphs, so a gap of four blank lines needs two passes.

Online: the Text Cleaner handles both jobs — joining broken lines and collapsing blank lines — without the marker steps. Paste the text in, and it works out which breaks are real paragraph gaps and which are wrapped lines.

Top view of a cluttered office desk with crumpled papers, laptop, and eyeglasses

Strip Smart Quotes, Tabs, and Hidden Characters

Once the spaces and breaks are fixed, a few invisible characters are usually still hiding in the text.

Smart quotes. Word processors turn straight quotes (") into curly quotes (“ ”) and straight apostrophes into curly ones (’). That looks nice in a document, but it breaks code, breaks some search boxes, and shows up as a strange character in older systems. To fix them in Word, use Find and Replace: search for “ and ” and replace with "; search for ’ and replace with '. To stop Word doing it again, turn off smart quotes under File > Options > Proofing > AutoCorrect Options > AutoFormat As You Type.

Tabs. A tab character looks like a gap of unknown width, and it shifts when the font or the app changes. In Word’s Find and Replace, ^t is a tab: find ^t and replace with a single space (or with nothing, if the tab was being used to indent a line).

Non-breaking spaces. A non-breaking space looks exactly like a normal space but behaves differently: it glues two words together so they never split across lines, and it does not match a normal space in Find and Replace. That is why a double-space search sometimes leaves a gap behind. In Word, ^s is a non-breaking space: find ^s and replace with a normal space.

Trailing spaces. A space at the end of a line is invisible on screen but real in the file, and it causes two problems: it makes lines look different to dedupe tools, and it leaves ragged gaps if the text is reflowed. In Word, find ^w^p (any whitespace followed by a paragraph mark) and replace with ^p to strip trailing spaces from every paragraph at once.

Clean Text in Word and Google Docs (Find & Replace Tricks)

Here is the full set of Word Find and Replace codes in one place, so you do not have to look them up again:

Code What it finds Common fix
^p Paragraph mark (Enter) ^p^p → ^p removes blank lines
^l Manual line break (Shift + Enter) ^l → space joins wrapped lines
^t Tab ^t → space removes tab spacing
^s Non-breaking space ^s → space normalises spaces
^w Any whitespace (space or tab) ^w^p → ^p strips trailing spaces
^m Manual page break Review one by one with Find Next

Google Docs has a smaller set of tricks. Its Find and Replace (Ctrl + H) supports regular expressions when you tick Match using regular expressions. The useful ones for cleanup are + for runs of spaces, \t for tabs, and \n\n+ for runs of blank lines. Docs cannot search for paragraph marks the way Word can, so for heavy line-break repair, clean the text in the online tool first and then paste it into Docs. For more on working with Google’s apps, see our Google Workspace tips for beginners.

Hands typing on a laptop keyboard viewed from above

The One-Click Fix: Clean It Online

Whatever the source, how to clean up copied text remove extra spaces comes down to the same three fixes: collapse the spaces, join the broken lines, and strip the hidden characters. If the text is still in your clipboard and not yet inside a document, the fastest fix is the free Text Cleaner. Paste the messy text in, and it removes extra spaces, joins broken lines, collapses blank lines, and strips stray tabs and hidden characters in one pass. Copy the result out and paste it wherever it needs to go.

It is the right tool when the text came from a PDF and every line is broken, or when you are cleaning a list before pasting it into a spreadsheet. If the text also has repeated lines, run it through the Duplicate Line Remover afterwards to drop the repeats.

And if the text is already inside a Word document, do the cleanup there with Find and Replace rather than copying it out and back in: every round trip through the clipboard is another chance for the formatting to change.

A stylish workspace featuring a laptop, plant, and smartphone on a desk

Frequently Asked Questions

How do I remove extra spaces from copied text?

Paste the text into a free text cleaner tool, which collapses every run of spaces into one. In Word, press Ctrl + H, search for two spaces, replace with one space, and click Replace All repeatedly until no more are found. In Google Docs, use Find and Replace with regular expressions on and search for ” +” (space plus).

Why does text copied from a PDF have broken lines?

A PDF stores lines of text at fixed positions on a page, not paragraphs. When you copy, each visual line comes with a line break at the end. Join them with Find and Replace, or paste the text into a text cleaner that does it for you.

How do I paste without formatting?

Use Ctrl + Shift + V in most apps, including Word, Google Docs, and browsers. This stops fonts, colours, and background shading coming across with the text.

What is the ^p code in Word Find and Replace?

^p is Word’s code for a paragraph mark — the character created when you press Enter. Searching for ^p^p and replacing with ^p removes blank lines. Related codes are ^l for a manual line break, ^t for a tab, ^s for a non-breaking space, and ^w for any whitespace.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top