How to Fix Broken Line Breaks in Text Copied From a PDF or Email

Why text pasted from PDFs and emails breaks mid-sentence, and how to join the lines again while keeping paragraphs and repairing hyphenated words.

Updated September 29, 2026 6 min read

Use the free Remove Line BreaksJoin broken lines from PDFs and emails while keeping paragraphs

You copy a paragraph from a PDF report, paste it into an email or a document, and it arrives chopped into short lines. Every line ends exactly where it ended on the PDF page, sometimes in the middle of a word with a dangling hyphen. Fixing it by hand means clicking at the end of each line and pressing Delete, then adding a space, dozens of times.

This guide explains where those unwanted breaks come from, how to tell the difference between a break you should keep and one you should remove, and how to clean the text in one step in a browser, in Word, in a code editor or on the command line.

Why pasted text breaks in the middle of sentences

Most documents store a paragraph as one long line of text and let the screen wrap it. A PDF works differently. It is a description of a printed page, so each line is placed at an exact position. When you copy from a PDF, the viewer has to guess how those positioned lines fit together, and the simplest guess is to put a line break after each one. The same happens with:

  • Plain-text emails, which are often wrapped at around 72-78 characters by the sending program.
  • Terminal output and log files, where long lines are wrapped to the window width.
  • Text from OCR, where each scanned line becomes its own line of text.
  • Justified book layouts, where words split across lines with a hyphen.

The result contains two kinds of line breaks that look identical in the file: soft breaks that were only there because the page ran out of width, and hard breaks that genuinely separate paragraphs. A good clean-up removes the first kind and keeps the second.

Paragraphs, blank lines and hyphens

The practical rule that works for most copied text is this: a single line break is layout, a blank line is structure. If two chunks of text are separated by an empty line, they were almost certainly separate paragraphs. If a line simply ends and the next line continues the sentence, the break can go.

Hyphens are trickier. When a word such as "information" is split as infor- / mation, the hyphen is a typesetting artefact and should vanish. But a genuine compound such as well-known can also land at the end of a line. A careful approach only rejoins a hyphen when a letter comes before it and the next line starts with a lowercase letter, which catches most split words while leaving hyphens before capitalised words and numbers alone.

Remove line breaks in your browser

Our Remove Line Breaks tool applies these rules automatically and runs entirely in your browser, so the text is not uploaded.

  1. Open Remove Line Breaks and paste your text into Text with line breaks. Click Sample if you want to see an example first.
  2. Leave Keep paragraphs switched on if blank lines should stay as paragraph breaks. Switch it off to turn everything into one continuous block.
  3. Choose what goes in place of each break under Replace each line break with: A space (the usual choice for prose), Nothing (join directly), Comma + space, Comma, or Custom text…, which accepts \n and \t.
  4. Keep Join hyphenated words on to repair words split across lines, and Tidy spaces on to trim each line and collapse double spaces.
  5. Read the result in Text without line breaks. The summary line tells you how many breaks were removed and how many were kept.
  6. Click Copy or Download to take the cleaned text with you.

The output updates as you type or change an option, so it is quick to try both paragraph settings and compare.

Using it for lists, not just prose

The replacement option makes this tool useful beyond fixing paragraphs. If you have a column of product codes, one per line, choosing Comma + space turns it into A100, A101, A102 in one step. For more control over lists, such as wrapping each item in quotes or removing duplicates, the Comma Separator is built for that job.

Other ways to remove line breaks

Microsoft Word

Word's Find and Replace understands special codes. In the Replace dialog, search for ^p (paragraph mark) and replace it with a space. To keep real paragraphs, first replace ^p^p with a placeholder such as ###, then replace ^p with a space, then replace ### with ^p^p. It works, but three passes are easy to get wrong, and Word does not repair split hyphens for you.

Google Docs

Google Docs supports regular expressions in Find and replace when you tick "Match using regular expressions". Searching for \n handles some cases, but how line breaks are represented in Docs depends on how the text was pasted, so results can vary. Pasting as plain text first (Ctrl+Shift+V) makes behaviour more predictable.

Code editors

VS Code, Notepad++ and similar editors support regex search and replace. A common pattern replaces a single newline that is not part of a blank line:

Find:    (?<!\n)\n(?!\n)
Replace: (a single space)

This is fast for developers, but lookbehind support and line-ending handling (\r\n on Windows) differ between editors, so test on a copy.

Command line

On macOS and Linux, tr '\n' ' ' < input.txt replaces every newline with a space. It does not preserve paragraphs. For paragraph-aware joining, fmt or awk scripts can do it, which is worthwhile if you process many files in a batch.

Copying differently in the first place

Some PDF viewers produce cleaner text than others, and selecting a single column rather than the whole page reduces the damage. If the PDF is long, extracting its text in one go with PDF to Text and then cleaning the result is often faster than copying page by page. Our guide on how to copy text from a PDF covers the copying side in more detail.

Tips and troubleshooting

Paragraphs merged into one block

If the source had no blank lines between paragraphs, there is nothing to tell soft and hard breaks apart, so everything joins. Add a blank line between paragraphs in the input (it only takes a few seconds for a short text), then run it again with Keep paragraphs on.

Words glued together

If you chose Nothing (join directly), words at line ends will touch. Switch to A space. If words still touch, the original lines may have had no trailing space and the break was replaced by an empty custom separator.

A compound word lost its hyphen

When a genuine hyphenated term like self-service fell at a line end with the second half starting in lowercase, it will be joined as selfservice. Turn Join hyphenated words off, or fix the few cases by hand afterwards. Our Find and Replace tool can repair repeated terms in one pass.

Extra spaces and odd characters remain

PDF text sometimes contains non-breaking spaces, tabs or doubled spaces. Tidy spaces handles ordinary doubled spaces; for deeper clean-up, run the result through Remove Extra Spaces.

Bullet points ran together

Bulleted lists have no blank lines between items, so they join into one line. Paste lists separately, or keep Keep paragraphs on and add blank lines between the bullets you want to preserve.

Frequently asked questions

Why does text copied from a PDF have line breaks?

A PDF stores each line at a fixed position on the page rather than as flowing paragraphs. When you copy, the viewer usually inserts a line break after every positioned line, which splits sentences.

How do I remove line breaks but keep paragraphs?

Keep the blank lines between paragraphs and remove only single line breaks. In our tool, leave Keep paragraphs switched on and choose A space as the replacement.

Can I replace line breaks with commas?

Yes. Choose Comma + space or Comma under Replace each line break with, which turns a vertical list into a single comma-separated line.

What does "Join hyphenated words" do?

It removes a hyphen at the end of a line when a letter comes before it and the next line starts with a lowercase letter, so infor- followed by mation becomes information.

Is my text uploaded anywhere?

No. The tool processes text in your browser, so nothing is sent to a server. You can use it for confidential documents.

Try it now: Remove Line Breaks

Loading tool…