How to Remove Line Breaks When Copying Text from a PDF
Copied text from a PDF that breaks mid-sentence every 70 characters? Here is why it happens and five ways to fix it — online tool, Word, Excel, Google Sheets, and Python/JavaScript.
How to remove line breaks when copying text from a PDF is something most people figure out by accident — or spend 20 minutes manually deleting breaks one by one. The problem is not your clipboard or your text editor. It is how PDFs store text. This guide explains exactly why it happens and gives you five different ways to fix it — from a one-click online tool to formulas for Excel, Google Sheets, Word, and Python.
Why does text copied from a PDF have line breaks?
PDFs do not store text as flowing paragraphs the way Word documents or web pages do. Instead, PDF text is stored in small chunks tied to exact visual positions on the page. When a line of text reaches the edge of the column, the PDF encodes a line break at that point — not at the end of the sentence, but at the end of the visual line.
When you copy that text and paste it anywhere — an email, a Word document, Notion, Slack, a database field — those visual line breaks come along with it. The result is a paragraph that breaks mid-sentence every 50 to 80 characters, matching wherever the column was in the original PDF.
The problem is worse with:
- Multi-column PDFs — academic papers, newsletters, annual reports — where the column is narrow and breaks happen more frequently
- Scanned PDFs — where OCR software has to guess where each line ends
- Tables and callout boxes — content inside table cells copies with a break after every cell
- Older PDFs — documents made before 2005 often have poor text encoding that produces extra spaces and hyphens in addition to line breaks
The fastest fix: use the Remove Line Breaks tool
The quickest solution is to paste your copied PDF text into the Remove Line Breaks tool. It strips every Windows (CRLF), Unix (LF), and Mac (CR) line ending in one click — replacing each with a single space so words do not get joined together.
Example: You copy the executive summary from a 40-page PDF annual report. The pasted text looks like this:
Revenue increased by 14% year over year,
driven by strong performance in
the enterprise segment and new
customer acquisition in the APAC region.Paste it into the Remove Line Breaks tool, click the button, and you get:
Revenue increased by 14% year over year, driven by strong performance in the enterprise segment and new customer acquisition in the APAC region.One continuous sentence, ready to paste wherever you need it. If a scanned PDF produces hyphenated words at line breaks (like enter-
prise), run the result through a find-and-replace for - (hyphen space) → nothing, to rejoin them.
How to remove line breaks in Microsoft Word
If you work primarily in Word and want to clean the text without leaving it, Word's Find & Replace handles this with a wildcard syntax.
Method 1 — Remove paragraph marks (most common):
- Press Ctrl+H to open Find & Replace
- In the Find what field, type:
^p(paragraph mark) - In the Replace with field, type a single space:
- Click Replace All
Method 2 — Remove manual line breaks: Some PDFs produce manual line breaks (Shift+Enter) rather than full paragraph marks. If Method 1 leaves breaks behind, use ^l (lowercase L) in the Find field instead of ^p.
When to use each: Paste the PDF text into Word. View → Show formatting marks (Ctrl+*). If you see ¶ (pilcrow) symbols, use ^p. If you see downward arrows (↵), use ^l.
How to remove line breaks in Excel
Excel line breaks most commonly appear in cells from CSV exports and from pasting multi-line text. Two functions handle this:
| Situation | Formula | What it does |
|---|---|---|
| Remove all non-printable characters | =CLEAN(A1) | Strips line breaks, tabs, and other invisible characters |
| Replace line breaks with a space | =SUBSTITUTE(A1,CHAR(10)," ") | Replaces Alt+Enter (LF) with a space — preserves word separation |
| Remove both LF and CR | =SUBSTITUTE(SUBSTITUTE(A1,CHAR(10)," "),CHAR(13),"") | Handles both Unix (LF) and Windows (CRLF) line endings |
Example: Cell A1 contains:
Revenue increased 14%
year over yearFormula: =SUBSTITUTE(A1,CHAR(10)," ") returns: Revenue increased 14% year over year
Find & Replace method: Press Ctrl+H. In Find what, press Ctrl+J (you will not see anything but it inserts a line feed character). Leave Replace with empty or type a space. Click Replace All.
How to remove line breaks in Google Docs and Sheets
Google Docs: Edit → Find and replace → check Regular expressions → in Find type \n → in Replace type a space → click Replace all.
Google Sheets: Use the same SUBSTITUTE formula as Excel: =SUBSTITUTE(A1,CHAR(10)," "). CHAR(10) is the line feed character in both Excel and Google Sheets.
Tip: If you are cleaning many cells at once, use the ARRAYFORMULA wrapper: =ARRAYFORMULA(SUBSTITUTE(A1:A100,CHAR(10)," "))
How to remove line breaks using Python or JavaScript
For developers processing PDF text programmatically:
# Python — join all lines with a space
text = " ".join(text.splitlines())
# Python — remove only
, keep paragraph spacing (double newlines)
import re
text = re.sub(r'(?<!
)
(?!
)', ' ', text)
# JavaScript — replace all line endings with a space
const cleaned = text.replace(/[
]+/g, ' ');
# JavaScript — remove only single line breaks (keep paragraph breaks)
const cleaned = text.replace(/(?<!
)
(?!
)/g, ' ');The second Python and JavaScript examples use a negative lookbehind and lookahead to preserve intentional double-newline paragraph breaks while removing single line breaks that appear mid-sentence. This is useful when the PDF has both paragraph structure and mid-sentence column wrapping.
Key takeaways
- PDFs store text tied to visual positions on the page — every column line end becomes a hard line break when pasted.
- The fastest fix is the Remove Line Breaks tool — paste, click, copy.
- In Word: Ctrl+H → Find
^p→ Replace with a space → Replace All. - In Excel and Sheets:
=SUBSTITUTE(A1,CHAR(10)," ")replaces line breaks with spaces. - In Python:
" ".join(text.splitlines()). In JavaScript:text.replace(/[\r\n]+/g, ' '). - After removing line breaks, run Remove Extra Spaces to clean up any double spaces left behind.
Frequently asked questions
Why does my copied PDF text have a line break every 70 characters?
That matches the column width of the original PDF. PDFs store each visual line as a separate text chunk, and the character count per line reflects the physical column width in the document. This is normal — the Remove Line Breaks tool handles it in one step.
The line breaks are gone but now some words have hyphens in the middle. How do I fix that?
Older PDFs use soft hyphens to break long words across lines (like enter-prise). After removing line breaks, open Find & Replace and search for - (hyphen followed by a space) and replace with nothing. This rejoins the split words. In regex: search -\s+, replace with empty string.
Will removing line breaks delete paragraph spacing?
If you use the "replace with space" option (default), each line break becomes a space — so paragraphs collapse into one continuous block of text. If you want to keep paragraph spacing, use the "remove only single line breaks" option — this preserves double line breaks (paragraph gaps) while removing mid-sentence breaks.
Can I remove line breaks from a PDF without copying the text first?
Not easily in a browser. For bulk processing, tools like Adobe Acrobat Pro, pdfplumber (Python library), or pdf2txt.py extract text with better paragraph detection. For most use cases, copy-paste then clean is faster than setting up a PDF parser.
Why does my PDF text have extra spaces between words after I paste it?
This happens with scanned PDFs where OCR (optical character recognition) has misidentified character spacing. After removing line breaks, run the text through the Remove Extra Spaces tool to collapse multiple consecutive spaces into single spaces throughout the text.
Free tool
Try the Remove Line Breaks
Use our free remove line breaks to calculate results instantly — no signup required.
Open Remove Line Breaks →