Remove line breaks

Paste text with broken lines, such as a paragraph copied from a PDF or an old email, and get clean paragraphs back. Runs in your browser; nothing is uploaded.

Options

How to remove line breaks

  1. Paste your text into the left box. The cleaned version appears on the right as you type or paste.
  2. Choose what goes where each line break was. A space is right for prose; "nothing" suits text where lines were split mid-word, and custom text (a comma, for example) turns a list into one line.
  3. Keep "Keep paragraph breaks" ticked to keep the blank lines between paragraphs. Untick it to get everything on a single line.
  4. Click Copy result and paste it where you need it.

Your options are remembered in the page address, so a bookmark opens the tool with the same settings. Your text is never saved or uploaded.

What each option does

Keep paragraph breaks

A single line break is treated as a break inside a paragraph and removed. One or more empty lines in a row are treated as a paragraph break and kept as one empty line. This is what you want for most text from PDFs, emails and web pages.

Remove extra spaces

Turns runs of spaces and tabs into a single space, removes spaces at the start and end of each line, and turns non-breaking spaces into ordinary ones. Text copied from PDFs and old emails is often full of these, and joining lines can leave double spaces behind.

Fix words split across lines

When a word is too long for the end of a line, typeset documents split it with a hyphen: "inform-" on one line and "ation" on the next. Copying from the PDF keeps the hyphen and the break. With this option on, a hyphen at the very end of a line that is followed by a lower-case letter on the next line is removed, and the two halves are joined into one word. Invisible soft hyphens are removed too.

There is one trade-off: a real hyphenated compound that happens to break at its hyphen, such as "long-" and "term", is joined into "longterm". The tool shows how many words it rejoined, so you can check them, or turn the option off for text full of compounds.

Why text breaks into short lines

Most documents store paragraphs, and let the screen decide where each line wraps. PDFs are different: they store each line of text at a position on the page, with no record of which lines belong together. When you copy from a PDF, the reader has to guess, and it usually puts a hard line break at the end of every line. Paste that into a document, an email or a form and the text keeps the page's line lengths, often with hyphenated word fragments and double spaces.

Plain-text email has the same problem from a different cause. Older email programs wrapped text at around 72 to 80 characters per line by inserting real line breaks, so quoted replies arrive chopped into short lines. Text copied from terminal windows, subtitle files and some websites can do the same.

Troubleshooting

  • All my paragraphs merged into one. The source probably had no blank lines between paragraphs, just a single line break like every other line, so there is nothing to tell them apart. Add a blank line between paragraphs in the left box and they will be kept.
  • Words are stuck together. Choose "A space" rather than "Nothing" as the replacement.
  • A list turned into one long line. That is expected; for lists you want to clean rather than join, use the duplicate line remover, which trims and sorts lines.
  • The capitals are wrong too. Text from scanned PDFs is sometimes all in capitals. Run it through the case converter after joining the lines.
  • Need to check the length? Paste the result into the character counter, or work out how long it takes to read with the reading time calculator.

Frequently asked questions

How do I remove line breaks from text copied from a PDF? +

Paste the text into the box on this page with "Keep paragraph breaks" and "Fix words split across lines" ticked. The tool joins the lines inside each paragraph with spaces, rejoins words that were hyphenated at the end of a line, and leaves the blank lines between paragraphs. Copy the result into your document.

Why does text copied from a PDF have line breaks? +

A PDF stores where each line sits on the page, not which lines belong to the same paragraph. When you copy text out, most PDF readers put a line break at the end of every visual line, so a paragraph arrives as a stack of short lines.

How do I remove line breaks in Word? +

Open Find and Replace (Ctrl+H), type ^p in Find what and a space in Replace with, then click Replace All. That also removes the breaks between paragraphs, so a common trick is to first replace ^p^p with a placeholder such as ###, then replace ^p with a space, then replace ### with ^p^p.

What is the difference between a line break and a paragraph break? +

A line break ends one line and starts the next. A paragraph break is usually shown as an empty line between two blocks of text. This tool treats a single line break as a break inside a paragraph, and an empty line as a real paragraph break it can keep.

Will it join hyphenated words like "well-known"? +

Only when the hyphen is at the very end of a line and the next line starts with a lower-case letter, which is how a word split by the page width looks. A hyphen in the middle of a line, as in "well-known", is never touched. You can also turn the option off.

Related