Clean Up Text Copied From a PDF

Paste text copied from a PDF. Broken lines are joined back into sentences and hyphenated words are rejoined, while paragraphs and bullet points stay in place.

110 → 110 characters

Last reviewed:

Why text copied from a PDF breaks apart

PDF was designed to make a page look the same everywhere, not to keep text flowing. The Library of Congress describes it as a format for formatted, page-oriented documents, with text based on glyphs placed in fonts rather than on plain characters. Paragraphs and reading order only exist in the file if whoever made it added structure tags, and plenty of PDFs don't have them.

So when you copy, the reader rebuilds the text from where the letters sit on the page. You get a line break at the end of every printed line, words cut at end-of-line hyphens and odd gaps from justified spacing. The cleanup reverses each of these.

What you see after pastingWhat the cleanup does
A line break at the end of every printed lineJoins the lines of each paragraph with single spaces
Words cut at a line end, like “inter-” and “national”Rejoins them when the next line starts with a lowercase letter
Wide gaps between wordsCollapses runs of spaces
Invisible soft hyphensRemoves them
Page breaksTreats them as paragraph breaks
Bullets and numbered itemsKeeps each one on its own line

Before and after: a paragraph from a report

Example: Four printed lines from a survey report

  1. Line 1: The results of the sur-
  2. Line 2: vey show that most stu-
  3. Line 3: dents prefer morning
  4. Line 4: classes.

After cleaning: “The results of the survey show that most students prefer morning classes.” One sentence on one line, with both split words repaired.

Example: A bulleted list that wrapped

  1. Line 1: • Lower costs for
  2. Line 2: small schools
  3. Line 3: • New markets

After cleaning: “• Lower costs for small schools” and “• New markets” on two lines. A line that starts with a bullet begins a new item, and the wrapped line in between joins the item above it.

Blank lines are how the cleanup finds paragraphs, and they're kept as paragraph breaks. If your copy has no blank lines at all, the whole page joins into one block. Add an empty line at the start of each real paragraph, then clean it again.

Hyphenated words, compounds and capital letters

Only a hyphen at the very end of a line, followed by a line that starts with a lowercase letter, is treated as a split word. That rule gets ordinary words right, but it has two blind spots worth knowing.

  • Compounds that break at their own hyphen lose it. “well-” at the end of one line and “known” on the next become “wellknown”. Search the result for compound words you know are in the text.
  • Breaks before a capital or a number keep a stray space. “Franco-” and “Prussian” come out as “Franco- Prussian”, and “Covid-” and “19” as “Covid- 19”. Remove the space by hand or with Find and Replace.
  • Hyphens inside a line are never touched, so twenty-one and long-term stay exactly as printed.

Headers, page numbers, columns and odd bullets

  • Running headers and page numbers get joined into the sentence around them, so “Page 4” or a chapter title can land mid-paragraph. Delete them before cleaning, or search for them afterward.
  • Footnote markers stick to the word before them, as in “growth3”. Check for numbers glued to the ends of words.
  • Two-column pages may copy straight across both columns, mixing their lines. W3C accessibility guidance warns that screen readers can read an untagged two-column PDF in the same wrong order. Copy one column at a time.
  • Bullets from symbol fonts can paste as an empty box or a strange character instead of •. The cleanup only recognizes •, a hyphen, an asterisk, an en dash, or numbers like 1. and 1), so those lines get joined. Replace the odd symbol with • first, then clean.
  • Garbled or missing letters. Some PDFs don't record which character each glyph stands for, and their text pastes as gibberish or with gaps where fi and fl ligatures were. No cleanup can repair that; running OCR on the page image is the fallback.

Scanned PDFs and other text with hard line breaks

If you can't select any text in a PDF, the page is probably a scanned image with no text layer. It needs OCR (optical character recognition) first, and the OCR output will need the same cleanup plus a check for misread letters, such as rn read as m.

Hard line breaks aren't unique to PDFs. Old plain-text emails and mailing-list posts have them too. For text that only needs its lines joined, without hyphen repair or bullet handling, Remove Line Breaks gives you more control over paragraphs. Afterward, the Word Counter is a quick way to confirm nothing went missing: the total should be close to the original's.

Sources and further reading

How to use it

  1. 1Copy the text from your PDF and paste it in.
  2. 2Check the cleaned version on the right.
  3. 3Copy it into your document or email.

Questions

Why does PDF text paste with broken lines?

PDFs store text as positioned lines on a page, not as flowing paragraphs, so copying gives you a line break at the end of every printed line.

Will it break real hyphens like well-known?

Only a hyphen at the very end of a line followed by a lowercase word is treated as a split word. Hyphens inside a line are left alone.

Is my text uploaded anywhere?

No. Everything happens in your browser; your text never leaves your device.

Also handy: Text to QR Code, Shuffle a List