How do I remove line breaks from text?
Paste the text into the box above. Every line break is replaced right away, by default with a single space, so the text becomes one continuous line. Press Copy to use it. Nothing is uploaded: the work happens in your browser.
Line breaks come from PDFs (one hard break per visual line), wrapped emails, and spreadsheet cells with Alt+Enter. The text looks fine where it came from, then breaks in odd places when you paste it into a form, a CMS or a prompt.
How to use this tool
- Paste your text into the top box. The result updates as you type.
- Pick a mode. Remove all breaks gives one line. Keep paragraphs joins the lines inside each paragraph and keeps the blank lines. Custom separator swaps every break for a comma, a pipe, a tab or any text you type.
- Set the options. Fix hyphenated words repairs words a PDF split across two lines. Trim lines strips spaces at the start and end of each line. Collapse spaces turns runs of spaces into one.
- Copy or download. The counters under the buttons show how many breaks were removed and how many hyphenated words were repaired.
Why does text copied from a PDF have so many line breaks?
A PDF is a picture of a page, not a flowing document. Each line of a paragraph is placed separately, so a copy gives you one break per visual line, and the app cannot tell wrapping from a real paragraph end. Plain-text email works similarly: many clients wrap long lines at a fixed width, often around 72 to 78 characters. Hyphenation adds a third problem, because a long word split at the margin leaves a hyphen at the end of a line.
The fix is the same each time. Keep the breaks that end a paragraph, join the rest with a space and glue split words back together. That is Keep paragraphs plus Fix hyphenated words.
Worked examples
Keep paragraphs
The quick brown fox jumps. A second paragraph.
becomes two paragraphs, The quick brown fox jumps. and A second paragraph., with the blank line between them kept.
Custom separator
red, green, blue on three lines turns into red, green, blue with "Comma and space".
Hyphenated words
exam- followed by ple on the next line becomes example. This fix applies to the first two modes, not to Custom separator, where each line is a list item.
How does the hyphen fix avoid breaking real hyphens?
A hyphen at the end of a line can be a split word or a real hyphen, and no tool can be sure. This one only removes the hyphen when the evidence points to a split word:
- The character before the hyphen is a lowercase letter and the next line starts with a lowercase letter ("exam-" then "ple").
- The word before the hyphen has no other hyphen. In "state-of-the-" then "art" it is a compound, so the hyphen stays: "state-of-the-art".
- A capital on the next line ("Anglo-" then "Saxon") keeps the hyphen with no space: "Anglo-Saxon".
- Numbers ("1990-" then "2000"), a hyphen after a space and double hyphens are left alone.
- A soft hyphen (U+00AD) at a line end is always removed, because it only marks a split.
It cannot know when a real hyphenated word breaks at its hyphen: "well-" then "known" becomes "wellknown". If your text has many of these, turn the option off.
Which line break characters does it handle?
This tool treats all of these as a line break, so none are left behind.
| Character | Code | Where you meet it |
|---|---|---|
| Line feed (LF) | U+000A | Linux, macOS, most web text |
| Carriage return + line feed (CRLF) | U+000D U+000A | Windows files, many emails. Counted as one break. |
| Carriage return (CR) | U+000D | Classic Mac OS, some old exports |
| Vertical tab | U+000B | Word's Shift+Enter when pasted as plain text |
| Form feed | U+000C | Page breaks in some PDF and print text |
| Next line (NEL) | U+0085 | Legacy mainframe and some CSV exports |
| Line separator | U+2028 | Web pages, JSON and rich-text pastes |
| Paragraph separator | U+2029 | Rich-text pastes. Treated as a paragraph break. |
How do I remove line breaks in Word?
Word has two kinds: a paragraph mark (^p, from Enter) and a manual line break (^l, from Shift+Enter). Type the codes in lowercase.
- Press Ctrl+H on Windows (on a Mac, use Edit, Find, Replace).
- In Find what, type
^p. In Replace with, type a single space. - Click Replace All. Repeat with
^lif the text also has manual line breaks.
To keep paragraphs, do it in three passes: replace ^p^p with a marker that is not in your text, such as @@; replace ^p with a space; then replace @@ with ^p^p.
How do I remove line breaks in Google Docs?
Google Docs find and replace can match regular expressions.
- Press Ctrl+Shift+H (Cmd+Shift+H on Mac) to open Find and replace.
- Tick Match using regular expressions.
- Type
\nin Find and a single space in Replace with, then click Replace all.
The regex option may be missing in the Docs mobile apps. Guides for this method disagree on whether a Docs paragraph break and a Shift+Enter line break are both matched by \n, so try it on a copy of the document first.
How do I remove line breaks in Excel?
A line break inside a cell (Alt+Enter) is the character code 10, so you can swap it with a formula.
=SUBSTITUTE(A1,CHAR(10)," ")replaces each break with a space. Use", "to get a comma list, or""to delete the break.- Imported text can also hold
CHAR(13). Nest a second SUBSTITUTE for it:=SUBSTITUTE(SUBSTITUTE(A1,CHAR(13),""),CHAR(10)," "). =TEXTJOIN(" ",TRUE,A1:A10)joins the cells of a column into one cell, skipping blanks. TEXTJOIN needs Excel 2019 or later, or Microsoft 365.- For a one-off fix, select the cells, press Ctrl+H, click Find what, press Ctrl+J (it enters a line break) and put a space in Replace with.
Edge cases and limits
- Lists and poetry. Keep paragraphs joins every line with no blank line between them, so a list or a poem collapses into one paragraph. Use Custom separator for lists and leave poetry alone.
- Code and tables. Do not run source code or tab-separated tables through Remove all breaks. Line breaks are part of their meaning.
- Empty lines are dropped in Remove all and Custom separator modes, so you never get double spaces or
red,,green. - Chinese, Japanese and Thai do not use spaces between words. Choose Custom separator, then "(nothing)".
- Size. It runs in your browser. A 50,000-line paste finished in well under a second in our tests, so very large pastes are limited by your browser's text box.
The Word, Google Docs and Excel steps above follow Microsoft's and Google's public help pages and published guides. Menu names change between versions, so use the Special button in Word's Find and Replace dialog if a code does not work.
Frequently asked questions
How do I remove line breaks from text?
Paste the text into the box above and the line breaks are gone as you type. Press Copy to take the result.
Use Remove all breaks for one continuous line, or Keep paragraphs to join the lines inside each paragraph and keep the blank lines between them.
How do I remove line breaks from text copied from a PDF?
Choose Keep paragraphs and switch on Fix hyphenated words. PDFs store each visual line as its own line, so pasted text breaks at the page edge instead of at the end of a paragraph.
Keep paragraphs joins those lines back into paragraphs, and the hyphen fix glues words such as "exam-" and "ple" back together.
What is the difference between a line break and a paragraph break?
A line break moves the text to the next line, and a paragraph break is a blank line (two line breaks in a row) that separates blocks of text.
In Word, Enter inserts a paragraph mark (^p) and Shift+Enter inserts a manual line break (^l). In plain text both end up as newline characters.
Will this change the words in my text?
No. It only touches line breaks and, if you turn the options on, spaces around them and hyphens at the end of a line. Words, punctuation and capitals stay as they are.
Why does removing line breaks sometimes join two words together?
That happens when the replacement is nothing instead of a space. "end" and "start" on two lines become "endstart".
The default here replaces each break with a single space. Pick "(nothing)" under Custom separator only for text where words are not separated by spaces, such as Chinese or Japanese, or when you are repairing a split word.
Is my text uploaded anywhere?
No. The text is processed in your browser and never sent to a server, so it is safe to use with private documents.