How to remove line breaks from PDF text

PDFs store lines, not paragraphs. That is why every copy comes out shredded.

Copy a paragraph out of a PDF and it arrives chopped after every visual line, often with words split by a hyphen. The fix is to replace each single break with a space, keep the double breaks that mark real paragraphs, then check the hyphens by eye. You can do that pass in a browser, or on the clip itself before it lands.

Why the breaks are there at all

A PDF records where each letter sits on the page. Paragraph structure is not stored in any reliable way, so the line wraps that fit the column width are baked in as hard breaks. Copying takes them with it. The document looked like prose; the clipboard holds a stack of short lines.

Single break, double break. A single break is a wrap you want gone. A double break, the blank line, is the only paragraph boundary you have. Delete both and the whole extract becomes one flat block, which is worse than what you started with.

Order of operations. Join first, then collapse the runs of double spaces the join leaves behind, then drop the empty lines. Doing it the other way round loses the paragraph marks before you have used them.

The cleaners in Klipto's preview stack on one clip, so a PDF quote can be joined, de-spaced and stripped of formatting before it reaches Slack or a doc. One-line joins the whole clip into a single line, which is what you want for a single quoted paragraph.

For a multi-paragraph extract where the blank lines matter, the keep-paragraphs mode in the web version is the better pass: try it free in your browser. I use the browser one for long extracts and the preview for quotes, which covers almost everything I copy out of papers.

The hyphen trap

Justified PDFs hyphenate at the margin. "Company" becomes "com-" and "pany", and a plain join gives you "com- pany" or "com-pany". Neither is the word.

The dangerous part is fixing it with a blanket rule. Search and replace every hyphen and you destroy "well-known", "e-mail", "self-hosted" and every numeric range in the document. The pattern that is safe to automate is narrower: a hyphen immediately followed by a line break, with no space between them. In Word's Find and Replace that is -^p in the search field and nothing in the replace field, run before you join the lines.

Do that pass first, then join, then read the result once. Nothing I ship un-hyphenates automatically, and I am not planning to add it, because the false positives land in the middle of words and you would never spot them.

Two-column PDFs, where the text order itself is wrong

A two-column page copies in reading order that follows the file, not your eye. You get half a sentence from the left column, then half from the right, interleaved. No amount of line-break cleanup fixes that, because the words are in the wrong sequence.

Select one column at a time instead. In Preview, hold ⌥ and drag a rectangle over the left column only, copy, then repeat on the right. Two clean extracts beat one scrambled one.

That is the point where a staging pile earns its place. Copy the left column, copy the right, and both sit in the Stack waiting; ⌃⌘V pastes them in the order you collected them. Without a stack you paste the first one, switch windows, go back, copy the second, and hope you did not overwrite anything in between.

Frequently asked questions

Why does copied PDF text break after every line?

The PDF stores letter positions and bakes each visual wrap in as a hard break so the words fit the column width. Copying carries those breaks, so one paragraph arrives as many short lines.

How do I join PDF lines but keep the paragraphs?

Replace single breaks with a space and leave double breaks alone. The keep-paragraphs mode in the browser tool does exactly that, and it runs on your own machine with no upload.

How do I fix words split by a hyphen?

Replace a hyphen followed directly by a line break, `-^p` in Word, before joining the lines. Never replace hyphens generally, or compound words and number ranges break too.

Is there a way to do this without a website?

Yes. In Klipto the cleaners sit in the paste preview, so the clip is fixed on its way into whatever app has focus, offline.

Get Klipto for Mac

Free for 14 days · no card, no account required · 5 MB

Download Klipto