How to Remove Line Breaks from Text Copied from a PDF

Updated: November 2026

You copy a paragraph from a PDF, paste it into Word, and every line becomes its own paragraph. Sentences stop halfway, and editing one word doesn’t reflow anything. If the breaks came in as manual line breaks (Shift+Enter), justified alignment also stretches each fragment across the page.

The cause is how PDF works. Most PDFs record where each line sits on the page, not where a paragraph ends, so when you copy, many viewers turn the end of every visible line into a line break. This article is about those line breaks. Words hyphenated across lines are a separate problem, covered further down.

What we saw in our own file

We made a PDF of two Russian and two English paragraphs (LibreOffice 7.3) and extracted its text with pdftotext 22.02. Every line on the page came out as a separate line, and there was not a single blank line between paragraphs: the end of a paragraph looked exactly like the end of any other line.

That matters because the usual method, in advice and in many online tools, assumes paragraphs are separated by a blank line: keep those, remove the rest. Without blank lines, that method glues the whole document into one paragraph. Copying from a particular PDF viewer may give a different result, so look at your own text first: turn on Show/Hide (the ¶ button on Word’s Home tab) and check whether there is an empty line between paragraphs.

By hand in Word, when paragraphs are separated by a blank line

Open Find and Replace. The paragraph mark is in the Special menu, and Word inserts its code ^p for you. Make three replacements in order:

  1. Replace ^p^p with a marker that certainly isn’t in the text, such as ###. That records the real paragraph boundaries.
  2. Replace ^p with a space. Every break left is a line end inside a paragraph.
  3. Replace ### with ^p. The paragraphs are back.

By hand in Word, when there are no blank lines

Then the only way to tell a paragraph end is by its content: a paragraph usually ends with a full stop, and a line inside it can end with anything. In the advanced Find and Replace, tick Use wildcards and replace:

  • Find what: ([a-z0-9,])^13
  • Replace with: \1 (with a space after the 1)

The pattern finds a break after a lowercase letter, a digit or a comma and replaces it with a space, keeping the last character of the line. With wildcards on, the paragraph mark is written ^13: the ^p code doesn’t work in the Find what box in that mode. Lines that end with a full stop stay as they are, and so do paragraph ends that finish with punctuation. A heading or list item that ends with a letter or digit will be glued to the next paragraph, so select only the pasted text before Replace All and check headings afterwards. Lines where a sentence happened to end exactly at the edge stay broken: join those by hand. If your breaks are manual line breaks rather than paragraph marks, search for ^l instead of ^p. We put this pattern together from Microsoft’s wildcard documentation and did not run it in Word itself, so try it on a copy of the document first.

Words hyphenated across lines

If the PDF hyphenated words, joining lines gives “mean- ing”. Don’t replace hyphen-plus-break with nothing across the whole text in one go: genuine hyphens, as in “client-side”, disappear too when they fall at a line end. Search for -^p with Find Next before joining and fix each place.

Faster: the UnBot cleaner

UnBot’s text cleaner has a “Join lines broken by width” option, on by default. It takes the longest line as the page width and removes a break when the first word of the next line would not have fitted on the current one. On top of that, the next line must not start a list, heading or table, and one of two things must hold: it starts with a lowercase letter, or the current line doesn’t end with a full stop, question mark, exclamation mark, colon or similar. If the longest line is under 50 characters, the cleaner assumes the text was never wrapped and joins nothing. The number of joined breaks is shown under “What we found”.

How it did on our PDF (the same cleaning function run locally, 8 November 2026):

  • Russian paragraphs only: all 4 breaks inside paragraphs joined, and the paragraph ends were kept.
  • English paragraphs only: the same, 4 of 4.
  • Russian and English together: 5 of 8 joined. The English lines in our file were longer in characters, the cleaner took their length as the page width, and three breaks in the Russian paragraphs stayed. If a document mixes languages, or one line is much longer than the rest (a long link, say), paste the parts separately.
  • A line ending with a full stop, followed by one starting with a capital, stays separate, even in the middle of a paragraph.
  • A word hyphenated across lines is not repaired: you get “mean- ing”.
  • If the text has no blank lines at all, the Word and Google Docs options turn every break left after the joining into a paragraph end, so the document gets separate paragraphs. The cleaner has worked this way since 8 November 2026; before that, such text arrived as one paragraph with manual line breaks.

The cleaner runs in your browser and the text is not sent anywhere. The same option helps with text from an e-mail or a terminal, where lines are cut at a fixed width.

What no method fixes

If the PDF has two columns and the lines came out in the wrong order, joining breaks won’t restore the order: that text has to be checked against the document. The same goes for tables, reference lists and addresses, where a line break often carries meaning and should not be joined blindly.

Sources

Try UnBot for free

Paraphrase text without losing the meaning: numbers, names, quotes and links are checked against your original. The cleaner strips Markdown asterisks, moves formulas into Word and finds hidden characters. No signup.