Text tools

How to Remove Line Breaks from Text Copied from a PDF

Remove line breaks from text copied from a PDF in one click, or with Word find and replace (^p), Excel CHAR(10) and Notepad++. Keep paragraphs intact.

· 5 min read

To remove line breaks from text, paste it into our remove line breaks tool and choose Keep paragraph breaks. It joins the broken lines into proper sentences but keeps the blank line between paragraphs, which is exactly what you want for text copied from a PDF. Then copy the clean result. The text never leaves your browser.

If you would rather do it inside Word, Excel or Notepad++, the steps for each are below.

Why PDF text breaks in the middle of sentences

A PDF does not store paragraphs. It stores lines of text placed at exact positions on a page. When you copy from a PDF, the viewer has to guess where paragraphs end, and most simply add a line break at the end of every visual line. Paste that into an email, a form or a Word document and you get:

The candidate must upload a recent photograph and signature in JPG format within the size limits.

instead of one flowing sentence. The same happens with text from some emails, old websites and OCR output.

Remove line breaks online (three modes)

Our remove line breaks tool has three options:

Mode What it does Use it for
Keep paragraph breaks Joins lines inside each paragraph; keeps blank lines between paragraphs Text from PDFs, articles, emails
Replace with a space Turns every line break into a single space, giving one long paragraph A short passage, a form box that takes a single paragraph
Remove completely Deletes line breaks with nothing in their place Joining pieces of a code, ID or link split over lines

Steps:

  1. Copy the text from your PDF.
  2. Paste it into the box.
  3. Pick a mode. The result updates instantly.
  4. Click Copy result, or Download .txt.

"Keep paragraph breaks" relies on paragraphs being separated by an empty line. If your PDF copy has no blank lines at all, every line is joined into one block; add blank lines between paragraphs before converting, or split the result afterwards.

After cleaning, you can check the length with the word counter. For more on counting text from PDFs, see how to check word count.

Remove line breaks in Word with find and replace (^p)

Word uses special codes in Find and Replace: ^p is a paragraph mark (Enter) and ^l is a manual line break (Shift+Enter).

Remove all line breaks

  1. Press Ctrl+H (Cmd+Shift+H on Mac, or Edit > Find > Replace).
  2. In Find what, type ^p.
  3. In Replace with, type a single space.
  4. Click Replace All.

If nothing is replaced, the breaks are manual line breaks; repeat with ^l.

Remove line breaks but keep paragraphs

Do three replacements in order:

  1. Replace ^p^p with a placeholder that does not appear in your text, such as ###.
  2. Replace ^p with a space.
  3. Replace ### with ^p^p.

To see what kind of breaks you have, click the (Show/Hide) button on the Home tab.

Remove line breaks in Google Docs

Google Docs' Find and replace (Ctrl+H) supports regular expressions, but it does not reliably match paragraph breaks. The simplest route is to clean the text with the remove line breaks tool before pasting it into Docs.

Remove line breaks in an Excel cell

Line breaks inside a cell (made with Alt+Enter, or pasted from elsewhere) are the character CHAR(10).

With a formula

  • =SUBSTITUTE(A1,CHAR(10)," ") replaces each break with a space.
  • =TRIM(SUBSTITUTE(A1,CHAR(10)," ")) also removes extra spaces.
  • =CLEAN(A1) strips line breaks and other non-printing characters, but joins words without a space, so SUBSTITUTE is usually better.

Copy the result and use Paste Special > Values if you want to replace the original.

With Find and Replace

  1. Select the cells.
  2. Press Ctrl+H.
  3. Click in Find what and press Ctrl+J. Nothing visible appears (sometimes a tiny blinking dot), but a line break has been entered.
  4. Type a space in Replace with.
  5. Click Replace All.

In Google Sheets, =SUBSTITUTE(A1,CHAR(10)," ") works the same way.

Remove line breaks in Notepad++

  • Join Lines: select the lines and choose Edit > Line Operations > Join Lines (Ctrl+J). The selected lines become one.
  • Find and replace: press Ctrl+H, set Search Mode to Extended, type \r\n in Find what (or \n for files with Unix line endings) and a space in Replace with, then Replace All.
  • Keep paragraphs: switch Search Mode to Regular expression, find (?<!\r\n)\r\n(?!\r\n) and replace with a space. This joins single line breaks and leaves double ones.

Fix hyphenated words split across lines

PDFs often hyphenate long words at the end of a line: "applica-" on one line, "tion" on the next. Joining the lines gives "applica- tion". Our tool does not repair these automatically, because a real hyphen ("well-known") looks the same. After converting, search for "- " (hyphen followed by a space) and fix the ones that are split words.

Other cleanup after removing line breaks

  • Double spaces: in Word, replace two spaces with one and repeat until nothing is found.
  • Repeated lines: if your text is a list with repeats, use remove duplicate lines.
  • Headers, footers and page numbers from the PDF get mixed into the text. Delete them by hand.
  • Bullet characters (•) may come through as odd symbols. Replace them with a dash or delete them.

Common mistakes

  • Using "Replace with a space" on a long document and losing every paragraph. Use "Keep paragraph breaks" instead.
  • Searching for ^p when the breaks are ^l (or the other way round) in Word.
  • Forgetting Paste Special > Values in Excel and later deleting the original column.
  • Pasting PDF text straight into an online form. Many forms count line breaks as characters, and broken lines look careless to the reader. Clean it first.

Questions

Why does text copied from a PDF have line breaks?

A PDF stores text as positioned lines on a page, not as flowing paragraphs. When you copy it, most viewers put a line break at the end of every visual line, so sentences break in the middle.

How do I remove line breaks in Word using find and replace?

Press Ctrl+H, type ^p in Find what and a single space in Replace with, then click Replace All. To keep paragraphs, first replace ^p^p with a placeholder like ###, then ^p with a space, then ### with ^p^p.

How do I remove line breaks in an Excel cell?

Use =SUBSTITUTE(A1,CHAR(10)," "). Or select the cells, press Ctrl+H, click in Find what and press Ctrl+J to enter a line break, type a space in Replace with, and click Replace All.

How do I remove line breaks in Notepad++?

Select the lines and use Edit > Line Operations > Join Lines (Ctrl+J). Or press Ctrl+H, choose Extended search mode, find \r\n and replace with a space.

Related guides

All guides