Skip to content
Utilboxes

How to remove line breaks from text

Text copied from PDFs and emails breaks every line in the wrong place. How to join the lines into proper paragraphs, keep real paragraph breaks, and fix split words.

Published

Tools for this job: Text Cleaner · PDF to Text

Paste a paragraph from a PDF or an old email into a document and every line ends early, at the point where the original page wrapped. The text cannot reflow, so resizing the window leaves a ragged mess. Deleting each break by hand is slow; a cleaner can join them in one step while keeping your real paragraph breaks.

Why it happens

A PDF positions each line separately on the page. When you copy, many viewers insert a line break at the end of every visual line. Plain-text emails do something similar: older mail programs wrapped lines at around 72–76 characters and inserted real line breaks. The result is text where line breaks mean “the page ran out”, not “new paragraph”.

Join the lines step by step

  1. Paste the text into the Text Cleaner.
  2. Turn on “Join broken lines”. Single line breaks are merged into spaces, and blank lines, which mark real paragraphs, are kept.
  3. Leave “Collapse repeated spaces” on to tidy any double spaces left behind.
  4. Copy the cleaned text.

Hyphens at line ends

Justified PDFs often split long words across lines with a hyphen: “docu-” at the end of one line, “ment” at the start of the next. The cleaner rejoins these into “document”. The catch is that a genuinely hyphenated word that happened to fall at a line end, such as “well-known”, also loses its hyphen. Search the result for words that look run together.

When the paragraphs have no blank lines

Some sources do not put a blank line between paragraphs; a paragraph simply starts on a new line. Then the cleaner cannot tell paragraph breaks from wrapped lines, and everything joins into one block. Two options:

  • Before cleaning, press Enter once at the end of each real paragraph to add a blank line.
  • Clean everything into one block, then split paragraphs by hand where the sense changes.

Everything on a single line

Sometimes you want no breaks at all, for example to paste into a single spreadsheet cell or a form that rejects new lines. Join the lines first; then remove the remaining paragraph gaps with your editor's find and replace. In Word, search for ^p and replace with a space. In Google Docs, enable regular expressions and replace \n.

Lists and addresses

Joining lines is wrong for text where line breaks matter: addresses, poems, code, bulleted lists and tables. Clean only the paragraphs that need it, or paste those parts separately. When extracting a whole PDF, PDF to Text has its own “Join lines into paragraphs” option that you can turn off for poetry, code or addresses.

Other clean-up for copied text, including smart quotes and odd spacing, is covered in fixing text copied from a PDF.

Tools used in this guide

More tools for this job

All guides