How to Remove Line-End Hyphens From Text Copied Out of a PDF
Summary
- Line-end hyphens happen when a PDF stores words split across lines (e.g., “inter-” + “national”) and your copy/paste keeps the hyphen plus the line break.
- The safest fix is a targeted find/replace that removes hyphens only when they occur at a line break, not real hyphenated words.
- You can clean the text in Word, Google Docs, or a plain-text editor using regex (where available) and then reflow paragraphs.
- Always run a quick result check: search for “- ” patterns, scan for broken words, and confirm real hyphens (e.g., “well-being”) remain.
- If you do this frequently, a repeatable workflow (copy → paste as plain text → run the same replace steps → verify) reduces rework.
When you copy text out of a PDF, you may end up with words broken like hyphen + line break (for example, “trans-
formation”). That is not a typo you introduced; it is a side effect of how many PDFs store text in line-sized chunks. The goal is to remove only the “line-end hyphenation” while keeping legitimate hyphens inside real compound words.
This guide shows a reproducible example, multiple app-specific ways to fix it (desktop and browser), and a quick result check so you can trust the cleaned text.
What “line-end hyphens” look like (and why they appear)
In many PDFs, a word that visually wraps at the end of a line is stored as two pieces:
- Piece 1 ends with a hyphen (e.g., inter-)
- Piece 2 starts on the next line (e.g., national)
When you copy, the PDF text layer may include both the hyphen and a line break, producing:
inter-
national
What you want in your final text is:
international
A reproducible example you can test
Copy this “messy” sample into your editor to practice the cleanup steps:
Many PDF exports insert hyphenation at line ends. This can create inter- national words and mis- leading breaks. But you should keep real hyphens like well-being and state-of-the-art.
After cleanup, you want:
Many PDF exports insert hyphenation at line ends. This can create international words and misleading breaks. But you should keep real hyphens like well-being and state-of-the-art.
Method 1 (recommended): Remove hyphens only at line breaks using Find/Replace
The key is to match a hyphen that is immediately followed by a line break. That pattern is very different from a normal hyphen inside a word.
Option A: Microsoft Word (Windows desktop)
Best for: You already work in Word and want a reliable “hyphen + paragraph/line break” cleanup.
- Paste the PDF text into Word.
- Open Find and Replace (Ctrl + H).
- In Find what, enter: -^p
- In Replace with, leave it blank (or enter nothing).
- Choose Replace All.
What this does: It removes a hyphen right before a paragraph mark. Many PDF pastes use paragraph marks for each visual line, so this often fixes the majority of cases.
Result check in Word:
- Use Find (Ctrl + F) and search for -^p again. If it finds nothing, you removed that pattern.
- Scan a few places where you expect real hyphens (e.g., “state-of-the-art”) to confirm they remain.
If your paste uses manual line breaks instead of paragraph marks: Try -^l (hyphen + manual line break) in the Find box instead of -^p.
Option B: Google Docs (browser)
Best for: You want a browser-based workflow and your text is not too large.
Google Docs Find/Replace does not support the same special codes as Word in the same way, so use this practical approach:
- Paste into Google Docs.
- First, convert hard line breaks into normal paragraphs where possible:
- Select the pasted text.
- Try Format > Line & paragraph spacing adjustments if spacing looks odd (this does not remove breaks, but helps you see structure).
- Use Find and replace (Ctrl + H / Cmd + Shift + H).
- In Find, type a hyphen, then insert a line break:
- Type -
- Then press Shift + Enter once (this inserts a line break in many editors; behavior can vary)
- In Replace with, leave blank.
- Choose Replace all.
Important: If Docs will not let you reliably search for a hyphen followed by a break, use Method 2 (regex editor) or paste into Word/LibreOffice for the cleanup step, then move the cleaned text back into Docs.
Option C: LibreOffice Writer (Windows/macOS/Linux desktop)
Best for: You want a free desktop tool with strong Find/Replace options.
- Paste into LibreOffice Writer.
- Open Find & Replace (Ctrl + H).
- Enable Regular expressions (wording may appear as a checkbox in the dialog).
- In Find, use a pattern that targets hyphen + line break. One common approach is:
- -\n (hyphen followed by a newline)
- Replace with nothing.
- Replace All, then review.
If your paste uses paragraph marks differently, you may need to adjust the pattern. The principle stays the same: remove the hyphen only when it is immediately followed by a break.
Method 2: Use a regex-capable text editor for the cleanest control
Best for: You want precision and repeatability, especially for long documents.
Use an editor that supports regex find/replace (for example, VS Code, Sublime Text, Notepad++ on Windows, or similar). The exact UI labels vary by app, but the workflow is consistent:
- Paste the PDF text into the editor.
- Open Find/Replace and enable regex mode (often shown as .*).
- Remove hyphen + line break:
- Find:
-\r?\n - Replace: (empty)
- Find:
- Reflow lines into paragraphs (optional but common after PDF pastes):
- If every line is broken, you may want to replace single line breaks with spaces while keeping paragraph breaks.
- A common approach is:
- Find:
([^\r\n])\r?\n([^\r\n]) - Replace:
$1 $2
- Find:
- Then convert double line breaks into paragraph breaks if needed (often they already are).
Why this works: \r?\n matches both Windows and Unix line endings, so you remove hyphenation regardless of where the text came from.
Method 3: Fix it at the source (export or OCR differently)
Best for: You control the PDF generation or can re-export text.
- If the PDF came from Word/InDesign/LaTeX, exporting to a different format (like DOCX or HTML) may preserve paragraphs without hard line breaks.
- If the PDF is scanned, OCR output settings can affect whether line breaks and hyphenation are preserved. If your OCR tool offers an option to keep layout vs. flow text, “flow text” can reduce line-end artifacts.
This method varies widely by tool, so treat it as a “try if available” option rather than the primary fix.
Result check: confirm you removed only the bad hyphens
After any method, do a quick verification pass:
- Search for leftover patterns: Look for “- ” (hyphen followed by a space) and for suspicious fragments like “inter national” or “inter-national” where you expect a single word.
- Spot-check real hyphens: Confirm known compounds remain correct (e.g., “well-being”, “state-of-the-art”, “X-ray”).
- Read one paragraph aloud: You will quickly notice missing spaces or accidental joins.
Common pitfalls (and how to avoid them)
1) Removing all hyphens breaks legitimate words
A global replace of “-” with nothing will damage real hyphenated terms. Always target hyphen + line break, not hyphens everywhere.
2) PDFs that insert line breaks without hyphens
Some PDFs break lines without adding hyphens. In that case, you need a “reflow” step (replace single line breaks with spaces) rather than hyphen removal.
3) Soft hyphens (invisible characters)
Some text contains soft hyphens (a discretionary hyphen character that may not display consistently). If you still see odd breaks after removing “-” at line ends, try searching for “soft hyphen” in your editor’s special character tools, or paste into a plain-text editor to normalize formatting before running regex.
Frequently Asked Questions
FAQ 1: Why does text copied from a PDF have hyphens at the end of lines?
Answer: Many PDFs store text in line-sized chunks to preserve layout. If a word was hyphenated at the end of a line in the original layout, the PDF text layer may include the hyphen and a line break, so copying reproduces “word-” plus a new line rather than the intended full word.
Takeaway: The hyphens are usually a layout artifact, not something you typed.
FAQ 2: What is the safest way to remove only line-end hyphens (not real hyphens)?
Answer: Use Find/Replace (or regex) to remove a hyphen only when it is immediately followed by a line break (or paragraph mark). Avoid replacing all hyphens globally, because that will damage legitimate compounds like “state-of-the-art.”
Takeaway: Target “hyphen + break,” not “hyphen everywhere.”
FAQ 3: How do I remove line-end hyphens in Microsoft Word?
Answer: Paste the text into Word, press Ctrl + H, then replace -^p with nothing (and if needed, try -^l with nothing). This removes hyphens that occur right before a paragraph mark or manual line break created during the paste.
Takeaway: Word can remove line-end hyphens quickly if you use the break-aware codes.
FAQ 4: How can I do this in Google Docs if Find/Replace cannot match line breaks?
Answer: If Docs will not reliably search for a hyphen followed by a break, do the cleanup in a tool that can (Word, LibreOffice, or a regex-capable editor), then paste the cleaned text back into Docs. If Docs does allow it, try entering a hyphen in the Find box and then inserting a line break (often Shift + Enter) right after it, replacing with nothing.
Takeaway: When Docs is limiting, use a dedicated cleanup step elsewhere and return to Docs afterward.
FAQ 5: What regex removes hyphenation across line breaks?
Answer: A common pattern is -\r?\n replaced with nothing. It matches a hyphen followed by a newline, handling both Windows and Unix line endings. Use it in an editor that supports regex find/replace and review the result to ensure real hyphens remain intact.
Takeaway: -\r?\n is a practical starting point for removing line-end hyphens.
FAQ 6: After removing hyphens, my text still has weird line breaks. How do I reflow it?
Answer: If each visual line became a hard line break, you may need to replace single line breaks with spaces while preserving paragraph breaks. In a regex editor, one approach is finding ([^\r\n])\r?\n([^\r\n]) and replacing with $1 $2. Then keep double line breaks as paragraph separators.
Takeaway: Hyphen removal fixes broken words; reflow fixes broken paragraphs.
FAQ 7: How do I handle soft hyphens or invisible characters from PDFs?
Answer: Soft hyphens can survive copy/paste and behave inconsistently across apps. If you suspect them, try pasting into a plain-text editor first (to normalize formatting), or use your editor’s “show invisibles/special characters” feature to locate and remove them. Some editors let you search for the soft hyphen character directly once it is visible or copied.
Takeaway: If normal hyphen cleanup fails, invisible characters may be the cause.
FAQ 8: How can I quickly verify I did not break legitimate hyphenated words?
Answer: After cleanup, search for remaining hyphens and spot-check known compounds (for example, “well-being,” “state-of-the-art,” “X-ray”). Also scan for suspicious joins where two words became one without a space. A quick read-through of a few paragraphs helps catch errors that search misses.
Takeaway: Verify with a mix of search and spot-checking to keep real hyphens intact.
