Remove Line Breaks Online

Paste text to remove line breaks as you go: keep paragraphs or make one line, join with spaces, commas or anything else, and repair text copied from a PDF. Nothing is uploaded.

0 lines · 0 words · 0 characters

Mode
Replace line breaks with
Clean-up options

Why remove line breaks?

Text copied from a PDF, an email, a terminal or a subtitle file arrives hard-wrapped: every line ends with a break, even mid-sentence. Pasted into a document, a form, a chat or an AI prompt it shows up as ragged short lines, and fixing it by hand means deleting every break one at a time. This tool joins the lines back into normal paragraphs in one paste, keeps the paragraph, heading and list breaks that matter, and repairs the words a PDF split with hyphens.

How to remove line breaks

  1. Paste your text, or tap Paste. The result appears straight away.
  2. Choose Keep paragraphs to join the lines inside each paragraph, or Remove all for a single line.
  3. Pick what replaces each break: a space, nothing, a comma or your own separator.
  4. Press Copy or download a .txt file. Change an option and the result updates instantly.

Remove line breaks, keep paragraphs, or join with commas

Each setting on a short example, run through this tool as the page was built:

Keep paragraphs. The default: blank lines survive.

Input

Lines inside a paragraph
are joined with spaces.

A blank line starts
the next paragraph.

Result

Lines inside a paragraph are joined with spaces.

A blank line starts the next paragraph.
Remove all. Everything on one line.

Input

Lines inside a paragraph
are joined with spaces.

A blank line starts
the next paragraph.

Result

Lines inside a paragraph are joined with spaces. A blank line starts the next paragraph.
Comma. A list for a spreadsheet cell or SQL IN (...).

Input

apple
banana

cherry

Result

apple, banana, cherry
Nothing. Rejoins a URL, Base64 or code split over lines.

Input

https://example.com/a-very-
long/path/that/wrapped

Result

https://example.com/a-very-long/path/that/wrapped
Fix PDF text. Split words, the fi ligature and a number range repaired; “well-known” keeps its hyphen because the text spells it that way.

Input

The first well-known exam-
ple: a well-
known 2019-
2020 case.

Result

The first well-known example: a well-known 2019-2020 case.
Keep list items. A wrapped list item is joined; each item keeps its line.

Input

Bring:
- a pen and
paper
- your ID

Result

Bring:
- a pen and paper
- your ID

Fixing text copied from a PDF

A PDF doesn't store paragraphs. It stores where each run of text sits on the page, so when you copy, the viewer guesses where lines end and usually puts a hard break after every one. Three other problems tend to come along, and Fix PDF text repairs them:

  • Words split across lines. Justified text hyphenates long words: "hyphen-" at the end of one line and "ated" on the next become "hyphenated". The hyphen is kept when your text shows it belongs (it contains "well-known" and never "wellknown") or the word is already a compound ("state-of-the-art"). Before a capital or a digit, the hyphen stays and no space is added: "Anglo-Saxon", "2019-2020".
  • Soft hyphens. Some PDFs and web pages carry invisible soft hyphens (U+00AD) inside words. They break search and spell-check, so they are removed. To see other hidden characters a paste can carry, use the invisible character checker.
  • Ligatures. Fonts often draw "fi", "fl", "ff", "ffi" and "ffl" as one glyph, and copying can give you that single character. "final" then fails a search for "final"; the tool expands them back to separate letters.

Two things no line-break remover can fix: columns, which some viewers copy straight across, mixing lines from both columns, and page furniture such as running headers, footers and page numbers, which land in the middle of your text. Copy one column or page at a time and delete those lines before you paste.

How the tool decides which line breaks to keep

In Keep paragraphs mode, every line break is removed except these:

  • Blank lines. One or more empty lines (or lines of only spaces) mark a paragraph break. Several in a row become one, so the result has a consistent single blank line, or no blank line if you untick Blank line between paragraphs.
  • Paragraph ends without a blank line. Wrapped text has lines of roughly equal length, and a line only ends early when the next word doesn't fit. So a line that stops well short of the others although the next line's first word would have fitted, after a full stop, question mark or colon, was ended on purpose: that's a paragraph end. Short lines without a full stop between two sentences are kept as headings. This check only runs when most lines in a block are close to the same length, so poems, addresses and lists of names are still joined.
  • List items. Lines that start with a bullet (•, -, *, –) or a number or letter like 1. 2) (3) a) keep their own line; a list item that wrapped onto a second line is joined back together.

Wherever lines are joined with a space, the tool doesn't add a second one if the line already ended or began with a space, and it adds none at all between Chinese or Japanese characters, which are written without spaces. With Trim extra spaces on, runs of spaces become one and spaces at the start and end of lines go.

Line breaks explained: LF, CRLF and CR

A line break is one or two invisible control characters, and which ones depends on where the text was made:

NameWritten asWhere you meet it
LF (line feed)\n, U+000ALinux, macOS, Android, iOS and most web forms
CRLF\r\nWindows text files, e-mail and HTTP headers, and CSV files as defined by RFC 4180
CR (carriage return)\r, U+000DClassic Mac OS (version 9 and earlier) and some old exports
Unicode separatorsU+2028, U+2029Rare; some word processors and JSON data

The tool accepts all of them, even mixed in one paste, and writes plain \n line breaks in the result. Plain-text e-mail is a common source of hard-wrapped text, because the e-mail format standard (RFC 5322) recommends lines of no more than 78 characters, so many mail programs wrap long lines when they send.

How to remove line breaks in Word, Excel, Notepad++ and the command line

If the text is already in another program, these built-in methods work too:

  • Microsoft Word: Ctrl+H, find ^p (paragraph mark) or ^l (manual line break), replace with a space. Keep paragraphs by first replacing ^p^p with a placeholder like ###, then ^p with a space, then ### with ^p^p.
  • Excel: Ctrl+H, press Ctrl+J in "Find what" to enter a line feed, put a space in "Replace with". Or use =SUBSTITUTE(A1,CHAR(10)," "), which also works in Google Sheets.
  • Notepad++: Ctrl+H, Search mode "Regular expression", find \R, replace with a space.
  • VS Code: select the lines and run Join Lines from the Command Palette, or replace \n with regular expressions switched on.
  • macOS or Linux terminal: paste -sd ' ' file.txt joins all lines with spaces; tr '\n' ' ' < file.txt does the same.
  • Windows PowerShell: (Get-Content file.txt) -join ' '.

None of them repair hyphenated words or tell paragraph ends from wrapped lines, which is what makes PDF text worth pasting here.

More tools for cleaning up text

After joining the lines, count the result with the word counter or fix capitals with the case converter. Working with a list rather than prose? Remove duplicate lines or put it in order with the text sorter. For text copied from an AI chatbot, the Markdown cleaner strips stray formatting, and the text diff checker shows exactly what changed between two versions.

Frequently asked questions

How do I remove line breaks from text?

Paste the text into the box. Line breaks inside each paragraph are replaced with spaces straight away, and the result is ready to copy or download. Choose Remove all to put everything on one line, or pick Comma, Nothing or Custom under "Replace line breaks with" to join the lines with something other than a space.

How do I remove line breaks but keep paragraphs?

Leave the mode on Keep paragraphs (the default). Lines inside a paragraph are joined and blank lines between paragraphs stay. Text copied from a PDF often has no blank lines at all: with "Spot paragraph ends" ticked, a line that stops well short of the others although the next word would have fitted is treated as the end of a paragraph, and short headings keep their own line.

Why does text copied from a PDF have line breaks in the middle of sentences?

A PDF records where each line of text sits on the page, not which lines belong to the same paragraph. When you copy, the viewer has to guess, and most put a hard line break at the end of every visual line. Justified text adds words split with a hyphen across two lines, and some fonts store "fi" and "fl" as single ligature characters. This tool undoes all three.

How do I fix words split by hyphens when copying from a PDF?

Keep "Fix PDF text" ticked. A word broken as "exam-" at the end of one line and "ple" at the start of the next becomes "example". The hyphen stays when the word really is hyphenated: when "well-known" appears elsewhere in your text and "wellknown" doesn't, or when the word already contains a hyphen, as in "state-of-the-art". A hyphen before a number or capital letter is kept too, so "2019-2020" and "Anglo-Saxon" join without a space.

How do I replace line breaks with commas?

Choose Remove all, then Comma under "Replace line breaks with". A list with one item per line becomes "apple, banana, cherry", ready for a spreadsheet cell, an email or a SQL IN (...) list. Blank lines don't create empty items, and a line that already ends with a comma doesn't get a second one. Pick Custom for any other separator, such as " | ", a semicolon or a tab (type \t).

How do I remove line breaks in Microsoft Word?

Press Ctrl+H to open Replace. In "Find what" type ^p (a paragraph mark), in "Replace with" type a space, and choose Replace All. Manual line breaks made with Shift+Enter are ^l instead. To keep paragraphs, first replace ^p^p with a placeholder such as ###, then replace ^p with a space, then replace ### with ^p^p.

How do I remove line breaks in Excel or Google Sheets?

In Excel, select the cells, press Ctrl+H, click in "Find what" and press Ctrl+J, which enters the invisible line-feed character, type a space in "Replace with" and choose Replace All. As a formula, =SUBSTITUTE(A1,CHAR(10)," ") works in both Excel and Google Sheets; in Sheets you can also use Find and replace with "Search using regular expressions" and \n.

How do I remove line breaks in Notepad++ or VS Code?

In Notepad++, press Ctrl+H, set Search mode to Extended and replace \r\n (Windows files) or \n with a space; in Regular expression mode, \R matches every kind of line break. In VS Code, open Replace (Ctrl+H, or Cmd+Option+F on a Mac), switch on regular expressions (.*), and replace \n with a space, or select the lines and run Join Lines from the Command Palette.

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

A line break ends a line; a paragraph break ends a block of text. In plain text both are made of the same newline characters, and a paragraph break usually shows as an empty line, two breaks in a row. In Word, Enter makes a paragraph mark (^p) and Shift+Enter a manual line break (^l); in HTML they are <p> and <br>. This tool treats a blank line as a paragraph break and removes the others.

What are CR, LF and CRLF?

They are the control characters that end a line. Windows uses carriage return plus line feed (CRLF, \r\n), Linux, macOS, Android and iOS use a line feed alone (LF, \n), and classic Mac OS used a carriage return alone (CR, \r). The names come from typewriters and teleprinters: return the carriage to the start, then feed the paper up one line. This tool recognises all three, plus the Unicode line and paragraph separators, so files with mixed endings work too.

Is my text uploaded or saved anywhere?

No. Your text is processed by JavaScript in your browser and never sent to a server. Only the options you choose are remembered on this device, not the text itself.

Advertisement