Remove Line Breaks
tool.
Fix text that breaks after every line when you paste it from a PDF or an email.
- Line breaks found
- 6
- Typical line
- 44 chars
- Longest line
- 47 chars
It held 6 line breaks: 6 line feeds. A typical line has 44 characters and the longest has 47. Lines this even look hard wrapped.
How long each line is
Drag the handle to set a wrap width6 lines with text, typically 44 characters, the longest 47. 0 lines run past 72 characters.
Wrap it again
Whole words only, with paragraphs kept. Turn it on to break the cleaned text at this width.
Hyphens the rejoin option would close
| Line | Before | Next line | Joined |
|---|---|---|---|
| 6 | hyphen- | ated | hyphenated |
Rejoining is on. Check for real compounds such as well-known, which lose their hyphen.
Keyboard shortcuts
- C copies the cleaned text.
- Shift + R resets the tool and clears your text.
- Both work when no box has focus; click an empty part of the page first if you were typing.
How it's worked out
A line break is one or two hidden characters. Unicode lists three common forms: a line feed on Unix and modern Macs, a carriage return plus a line feed on Windows, and a carriage return alone on Mac OS 9 and older. It also says to treat them the same on input, and this tool does.
- Every form of line break becomes the same single line feed.
- Spaces at the start and end of each line go, unless you turn that off.
- If you ask, a hyphen at a line end closes up when a lowercase letter starts the next line.
- The chosen mode joins the lines, and runs of spaces shrink to one.
You pick one of three modes. Keep paragraphs treats a blank line as a real paragraph break and turns every other break into a space. All joins everything into one block. Custom puts your own separator, such as a comma, between lines, and that separator replaces each break.
The tool cannot tell a line break the author meant from one a program added. It uses one rule: a blank line is real, and a single break is not. That is why text with no blank lines between paragraphs comes out as a single block, and why you should look over the result.
Worked examples
Amina pastes a PDF into her report
Amina copies two short paragraphs from a PDF. The check finds 6 line breaks across 6 lines of text, with a typical line of 39 characters and 1 blank line between paragraphs. Lines of near-equal length are the sign of a hard wrap, which is a break added at a set width.
| Before | After |
|---|---|
| Text copied from a report often arrives / in short lines, with a hard break at the / end of each one. The sentence keeps going, / but the paste does not know that. / / A blank line marks the start of a new / paragraph, and that break is worth keeping. | Text copied from a report often arrives in short lines, with a hard break at the end of each one. The sentence keeps going, but the paste does not know that. / / A blank line marks the start of a new paragraph, and that break is worth keeping. |
Keep paragraphs removes 4 of the lines and leaves 2 paragraphs. The All mode would have given her one block of 239 characters and lost the split between her two ideas.
Kenji turns a column into a comma list
Kenji has 5 fruit names in a spreadsheet column, and a form that wants one line. He picks Custom with a comma and a space as the separator. The result is "apples, bananas, cherries, dates, figs".
That is 38 characters on 1 line. Any separator works, so a space, a bar and a space gives a list like "a | b | c" for a quick table cell.
Rosa cleans up an old email, then wraps it again
Rosa has an email with 4 short lines and 2 hyphens at line ends. She turns on the rejoin option and looks at the list of joins.
| Line | Before | Next line | Joined |
|---|---|---|---|
| 1 | well- | known | wellknown |
| 2 | exam- | ple | example |
The first join is wrong. "Well-known" is a real compound word, and the rule turns it into "wellknown". The second is right, since a typesetter split "example". She fixes the first by hand, or leaves the option off and repairs the second instead.
She then needs to send it to an old system that wants short lines, so she wraps it again at 40 characters. It comes back as 4 lines, the longest at 40 characters, and no word is cut in half.
Reading your result
Lines removed is a difference. It compares the line count before and after. Amina's count fell from 7 to 3, so it reads 4. Her blank line stays in the count on the way out, as one of the 3 lines.
The character count should barely move. Every break turns into a space, so a joined text is about the same length. Amina's stayed at 240 characters. A big drop means that something other than breaks went away, most often runs of spaces. Check that before you send it.
Which line endings were found. A plain Windows file shows only carriage return and line feed pairs: 2 here on a three-line sample. A mix, such as 1 pair, 1 line feed and 1 carriage return in one text, tells you that it passed through more than one system.
Why email wraps at set widths. RFC 5322 says that a line must be no more than 998 characters and should be no more than 78, not counting the break. RFC 3676 suggests lines of 72 or fewer. A typical line near 72 or 78 is a strong clue that the text came through email.
Where the clean text helps. Text copied from a PDF keeps its layout breaks, and a translation firm notes that machine translation can then read one sentence as several. A comma list suits a search, an email or a SQL query, where IN takes values separated by commas. Social posts and web forms may treat each break as a new paragraph, so joining the lines first keeps the text whole.
Your text stays with you. The tool runs in your browser and saves the text only on this device, so a reload keeps it, and nothing is uploaded. On a shared computer, use Reset when you finish.
Common mistakes
- Joining an address, a list or a poem. The line breaks carry meaning there. Keep paragraphs turns a three-line address into "Ana Ruiz 12 Oak Street Denver, CO 80202". Leave those parts out, or add them back after.
- Trusting the hyphen rule on compound words. A word like well-known at a line end loses its hyphen. A capital at the start of the next line stops the rule, so "Post-" and "Office" are left apart, giving 0 joins. Review each join in the list.
- Expecting blank lines where there are none. Some PDFs copy with no gap between paragraphs. All of it then comes out as one block, so put a blank line in at each new paragraph first.
- Using a separator made only of spaces. The tidy-up step shrinks runs of spaces, so three spaces between lines come out as "a b". Turn off the space tidy-up if you need them.
- Copying a page with columns. Joining the lines cannot fix the order if the copy jumped between columns. Copy one column at a time. Tables from a PDF usually need more cleanup than this as well.
Questions people ask
Sources
- The Unicode Standard, Version 18.0, section 5.8, Newline Guidelines
- RFC 5322, Internet Message Format, section 2.1.1, Line Length Limits
- RFC 3676, The Text/Plain Format and DelSp Parameters
- Microsoft Learn, Use search options in your Word add-in to find text
- Microsoft Support, TEXTJOIN function
- Microsoft Q&A, How do I get rid of carriage returns in text being copied from a PDF document into a Word document?
- Human Science Co., 8 easy and secure tools to translate PDF files, section 4-3
- MDN Web Docs, Regular expressions: character classes
- PostgreSQL documentation, Row and Array Comparisons, 9.25.1 IN