How-To Guides

How to Fix Spacing After Copying Text From a PDF

Copying text from a PDF leaves broken lines, split words and stray spaces. Here's a safe cleanup routine that restores clean, readable text.

Copy a paragraph from a PDF into Word or Google Docs, and the text often arrives looking nothing like the original. Every line ends mid-sentence, words are split with hyphens, and double spaces appear out of nowhere. A PDF does not store flowing paragraphs the way a word processor does — it stores individual characters placed at exact positions on a page, and when you copy, your PDF reader has to guess where one line ends and the next begins. It often guesses wrong.

Most of the damage follows a small set of patterns. This guide explains what goes wrong, a safe two-pass cleanup using FBSubNet's free Whitespace Cleaner, and the manual fixes for the broken lines no tool can decide for you.

Common PDF copy issues

Almost every messy PDF paste is a combination of the same six problems.

Hard line breaks after every visual line

A PDF stores text line by line, so each line on the page becomes its own paragraph when you paste. Reflowing the text does nothing, because every line break is a hard break. The fix is to rejoin the lines, covered below.

Hyphenated words split across lines

When a word does not fit at the end of a line, the PDF breaks it with a hyphen: "neighbourhood" becomes "neigh-" and "bourhood". Some hyphens exist only because of the line break, while others belong to the word itself, as in "well-known". Telling the two apart is a judgement call, and it is why the final pass has to be done by hand.

Double spaces and missing spaces

PDFs justify text by stretching the gaps between words, and copying can turn those gaps into double or triple spaces. The opposite happens too: words can lose the space between them, so "the garden" pastes as "thegarden". Ligatures are another culprit: pairs such as "fi" and "fl" are stored as one combined character in many fonts, and some PDF readers copy it as nothing at all, turning "file" into "le".

Page furniture copied into the text

Headers, footers, and page numbers are part of the page, so the copy includes them. A running header or a footer such as "Page 4" can land in the middle of a sentence and split it in two. The same happens with footnotes and captions, taken in reading order — rarely the order you want.

Two-column text read in the wrong order

Many reports and papers set text in two columns. A careless copy reads straight across the page instead of down one column and then the other, interleaving both columns into nonsense. If your paste reads like two sentences shuffled together, copy one column at a time by selecting it with the mouse.

Scanned PDFs with no text at all

Some PDFs are photographs of pages rather than real text. Copying from one gives you nothing, or a jumble of characters, because there is no text layer to copy. Those files need optical character recognition (OCR) first, covered briefly at the end.

Clean spacing safely

Work on a copy of the pasted text, and keep the original PDF open beside it so you can check anything that looks wrong. The cleanup has two passes: an automatic pass for spacing and blank lines, and a manual pass for the line breaks and split words the tool cannot judge.

Step 1: paste as plain text

If you have not pasted yet, paste as plain text: Ctrl+Shift+V on Windows and Linux, Cmd+Shift+V on a Mac, or Paste Special > Unformatted Text in Word. Plain-text paste drops the PDF's fonts, sizes, and colours, so the text takes on your document's own formatting. It does not fix broken lines or stray spaces, but it removes one whole layer of mess before you start.

Step 2: run the Whitespace Cleaner

Open FBSubNet's free Whitespace Cleaner — everything runs locally in your browser, so nothing you paste is uploaded anywhere. Paste the messy text in, then pick only the operations your text needs:

  • Trim spaces at each line edge (on by default) — removes leading and trailing spaces from every line.
  • Convert tabs to four spaces (off by default) — use it for table or two-column pastes.
  • Reduce runs of blank lines (on by default) — collapses long runs of empty lines to one.
  • End with exactly one newline (off by default) — guarantees the text finishes with a single line break.

Click Run tool and copy the result. The tool changes whitespace only — never punctuation or wording. One honest limitation: it does not collapse multiple spaces between words, and it does not rejoin lines the PDF broke. Those need the next steps.

Step 3: collapse the double spaces

Copy the tool's output into any text editor and open find and replace (Ctrl+H on Windows and Linux, Cmd+H on macOS). Search for two spaces, replace with one, and repeat until nothing is found — each pass halves triple and quadruple spaces too. Keep the original paste until you have checked the result.

Worked example: a fictional PDF extract, fixed end to end

Here is the routine applied to one short passage. The extract is fictional — a made-up paragraph from an imaginary community garden guide — but its defects are the real ones PDFs produce every day:

The Riverside Community Garden
opens its gates at sunrise each
morning. Volunteers water the
raised beds, weed the paths, and
harvest vegetables for the neigh-
bourhood food bank. New mem-
bers are welcome at the monthly
meeting, held on the first Satur-
day of the month.
Riverside Community Garden  •  Page 4

Five issues hide in those ten lines: every visual line ends with a hard line break, so one paragraph arrives as nine fragments; three words are split with line-break hyphens ("neigh-bourhood", "mem-bers", "Satur-day"); double spaces survive before the bullet; the footer has been copied in; and the break before the footer is real while the breaks inside the paragraph are not.

Pass 1, the Whitespace Cleaner, trims the line edges and collapses the double spaces. Pass 2, find and replace, catches any double spaces between words that survived. Then the manual pass: delete the footer line, rejoin the three split words, and join the wrapped lines into one paragraph:

The Riverside Community Garden opens its gates at sunrise each morning. Volunteers water the raised beds, weed the paths, and harvest vegetables for the neighbourhood food bank. New members are welcome at the monthly meeting, held on the first Saturday of the month.

The automatic passes handled spacing in seconds. The decisions — which hyphens to remove, which line breaks were real, and that the last line was a footer — needed a human reading against the original PDF. That is the whole method: automate the spacing, decide the structure yourself.

Correct remaining broken lines

After the automatic passes, three manual fixes remain. Take them one at a time, paragraph by paragraph.

Rejoin hyphenated words

Remove a hyphen only when it exists because of the line break. Delete the hyphen, join the halves, and ask whether the result is a real word. "Neigh-" plus "bourhood" gives "neighbourhood", so join it. But "well-" plus "known" gives "wellknown" — the hyphen belongs there, so keep it and remove only the line break. When unsure, check the original PDF or a dictionary.

Rejoin wrapped lines

Work paragraph by paragraph, never on the whole document at once. In Word, select one paragraph, open find and replace (Ctrl+H), search for ^p — the code for a paragraph mark — and replace it with a single space, choosing Replace All while the selection is active. Word limits the replacement to the selected text. Then re-add the paragraph break at the end. In Google Docs there is no paragraph-mark code, so delete each line break by hand and type a space. Leave lists and addresses alone — their line breaks are intentional.

Remove repeated headers, footers, and page numbers

Headers and footers repeat on every page, so remove them in bulk: once you know the exact repeated text, use find and replace to delete every occurrence at once. Page numbers are trickier, because the number changes on each page — search for the fixed part of the footer and delete the number with it. Do this after rejoining the lines: a footer in the middle of a sentence is much easier to spot once the sentence is whole.

Fix missing spaces and damaged letters

Read the rejoined paragraph slowly, out loud if you can. Your eye catches "thegarden" and "membersare" faster than any tool, because a tool cannot know where one word ends and the next begins. Watch for words that lost a letter to a ligature, such as "le" where "file" should be — if the same word is damaged the same way throughout, one find-and-replace fixes every occurrence. Also check quotes: PDFs sometimes paste curly quotes as odd characters, and a search finds them all.

For a deeper treatment of the spacing half of this job, FBSubNet's guide to removing extra spaces from copied text walks through the same tool with a longer before-and-after example, and the guide to removing empty lines from a document or list covers the blank-line half. For a long PDF paste, fix the spaces inside lines first, then the blank lines, then rejoin the broken lines last.

When cleanup is not enough

A few PDF problems sit outside this routine.

  • Scanned pages. If the PDF is a photograph of a page, there is no text to copy. Run it through OCR first — most PDF readers and phone scanning apps offer it — then clean the output with the same routine. Expect OCR errors of its own, such as "rn" read as "m".
  • Copy-protected PDFs. Some PDFs disable copying entirely. If selecting text does nothing, the file is locked — ask the author for an unlocked copy, or retype short passages by hand.
  • Tables and footnotes. A table copied from a PDF usually arrives as lines of text with the columns collapsed, and footnotes land wherever the reading order puts them. Rebuild small tables by hand and move each footnote back to its sentence.
  • Very long documents. For a whole chapter, fix one section at a time and keep the original PDF open — batching it page by page stops a mistake early in the document from being repeated fifty times.

Frequently asked questions

Why does text from a PDF paste with a line break on every line?

Because a PDF stores text as positioned lines on a page, not as flowing paragraphs. Your PDF reader copies each visual line separately, and your word processor treats each one as a new paragraph — so changing fonts or margins never fixes them.

Can I stop this happening next time?

Mostly. Paste as plain text (Ctrl+Shift+V or Cmd+Shift+V) and copy one column at a time from multi-column PDFs. You cannot prevent the hard line breaks entirely, but a plain-text paste plus the cleanup above cuts the job to a few minutes.

Does paste-as-plain-text fix everything?

No. It removes fonts, colours, and sizes, but keeps the hard line breaks, split words, double spaces, and copied headers and footers — a cleaner starting point, not a finished fix.

What if the PDF is a scan?

Then there is no text to copy — you need OCR first. Use your PDF reader's text-recognition feature or a phone scanning app, then run the recognised text through the same cleanup routine and proofread carefully.

A quick checklist

Keep this list beside you the next time a PDF paste goes wrong: paste as plain text; run the Whitespace Cleaner with line-edge trimming and blank-line reduction on; collapse the remaining double spaces with find and replace; rejoin split words, keeping real hyphens; rejoin wrapped lines paragraph by paragraph; delete the repeated headers, footers, and page numbers; and read the finished passage against the original PDF.