Remove Line Breaks
Paste your text to join its lines into one. By default each line break becomes a space and blank lines between paragraphs are kept, which fixes text copied from PDFs and emails.
0 words 0 characters 0 lines
Continue with this text: Remove extra spacesSentence caseWord counter
Your text stays in your browser: nothing is uploaded or stored on a server.
How to use it
- Paste your text in the box, open a plain-text file with Open file, or press Example to try the sample.
- Under Replace line breaks with, pick A space, A space, keep paragraphs, Nothing or Custom text.
- For text copied from a PDF, tick Rejoin words split by a hyphen at the end of a line (PDF).
- The result updates as you type. Press Copy or Download .txt, or Use as input to run the result through the tool again.
Your choice of mode is remembered the next time you open the tool in this browser.
The four modes
| Mode | Line breaks | Blank lines | Spaces around breaks |
|---|---|---|---|
| A space | Each break, or run of breaks, becomes one space | Removed: everything becomes one paragraph | Merged into the single space; double spaces anywhere are collapsed to one |
| A space, keep paragraphs | Single breaks become one space | Kept as one empty line between paragraphs | Merged into the single space; each paragraph is trimmed |
| Nothing | Deleted | Deleted | Left as they are |
| Custom text | Each line is joined to the next with your text | Skipped | Each line is trimmed |
Windows (\r\n) and old Mac (\r) line endings are converted first, so all three kinds of line break are handled the same way, also by the PDF option. The Unicode line separators U+2028 and U+0085 count as line breaks too, and the paragraph separator U+2029 counts as a blank line (a paragraph break).
A space, keep paragraphs is the default because it fits most pasted prose. A line that holds only spaces or tabs counts as blank, and two, three or ten blank lines in a row all become a single empty line, so the result has an even gap between paragraphs.
Nothing joins the lines with no character between them. Use it for text in which a line break cuts through a word, a URL or a long number. In normal sentences it glues the last word of one line to the first word of the next. A space that was already at the end of a line is kept, though, so end of and line become end of line.
Custom text starts with , (comma and space). You can type any separator: ; , |, /, or HTML such as <br>. Write \n to insert a line break, so \n\n turns single-spaced lines into lines separated by blank lines.
Rejoining hyphenated words from PDFs
Many PDFs are typeset with hyphenation, so a word split across two lines arrives as hyph- at the end of one line and enated at the start of the next. With the PDF option ticked, the tool deletes the hyphen and the line break when there is a lowercase letter on both sides, so the word is joined back together. Spaces or tabs around the break do not stop the match, accented letters count as letters, and the Unicode hyphen (U+2010) works like the ordinary -. While the option is on, the status line under the result counts the joins, for example “1 hyphenated word joined (check that the hyphens were not real)”.
| Before | Option off | Option on |
|---|---|---|
infor- / mation |
infor- mation | information |
caf- / és |
caf- és | cafés |
Jean- / Paul |
Jean- Paul | Jean- Paul |
COVID- / 19 |
COVID- 19 | COVID- 19 |
well- / known |
well- known | wellknown |
The last row shows the limit: the tool cannot tell a typesetting hyphen from a real one, so a compound word split at its own hyphen loses the hyphen. The option is off by default for that reason. After joining, use the count in the status line as a guide and search the result for words that need their hyphen back. Breaks next to a capital letter or a digit are never joined.
Worked example
This is the tool’s sample text, as it often arrives from a PDF:
Text copied from a PDF often breaks in the
middle of a sentence because each line of the
page ends with a line break. Words can be hyph-
enated across lines too.
A blank line marks a new paragraph.
With A space, keep paragraphs and the PDF option ticked:
Text copied from a PDF often breaks in the middle of a sentence because each line of the page ends with a line break. Words can be hyphenated across lines too.
A blank line marks a new paragraph.
With A space and the option off, the two paragraphs merge and the split word stays apart:
Text copied from a PDF often breaks in the middle of a sentence because each line of the page ends with a line break. Words can be hyph- enated across lines too. A blank line marks a new paragraph.
A list turned into one line with Custom text and the default , :
| Before | After |
|---|---|
apple / banana / (empty line) / cherry |
apple, banana, cherry |
The same list with ; gives apple; banana; cherry, and with <br> gives apple<br>banana<br>cherry.
When people need it
- Text copied from a PDF or a scanned document. Each printed line ends with a break, so pasted text wraps in odd places in an email or a web form. Join the lines, keep the paragraphs and rejoin the hyphenated words.
- Emails and plain-text newsletters that were wrapped at a fixed width and look ragged when quoted or forwarded.
- Form fields and spreadsheets that accept a single line, such as a product description, a meta description or a CSV cell. After joining, the character counter shows whether the text fits the limit.
- Lists copied from a column, a CRM export or a list of tags, turned into one comma- or semicolon-separated line.
- Subtitles and transcripts where each caption line is a separate line and you want readable paragraphs.
Edge cases and what the tool leaves alone
- Spaces inside a line. A space and A space, keep paragraphs also collapse runs of ordinary spaces to one, anywhere in the text. Tabs inside a line, non-breaking spaces and other characters are kept; the extra space remover can normalize those.
- Lists and headings. Bullet points written on single lines (
- one/- two) are joined into one line, because the tool only sees line breaks, not list markers. Put a blank line between items that must stay separate, or use remove empty lines if you only want to delete the gaps. - Leading and trailing breaks. Breaks at the start or end of the text are removed in every mode. The space modes and Custom text also trim the spaces next to them; Nothing keeps those spaces.
- Unicode line separators. U+2028 (line separator) and U+0085 (next line), which some programs use instead of
\n, are treated as line breaks in every mode. U+2029 (paragraph separator) is treated as a blank line, so A space, keep paragraphs keeps it as a paragraph break. - Soft hyphens. A soft hyphen (U+00AD, an invisible hyphenation hint) at the end of a line is removed and the two halves are joined with no space in every mode, whether or not the PDF option is ticked.
- Emoji, accents and other scripts are not changed; only line breaks, the spaces next to them and soft hyphens at line ends are.
Questions
How do I remove line breaks but keep paragraphs?
Choose A space, keep paragraphs (the default). Single line breaks become spaces, and any blank line, even one that holds only spaces or tabs, stays as one empty line between paragraphs.
How do I fix text copied from a PDF?
Paste it, keep A space, keep paragraphs and tick Rejoin words split by a hyphen at the end of a line (PDF) so that "hyph-" and "enated" on two lines become "hyphenated". Then check compound words such as "well-known", which the option also joins. The guide on removing line breaks from PDF text covers more cases.
Why are my words stuck together?
You chose Nothing, which deletes each line break without adding a space. That suits text where the line breaks fall inside a word or a long code, not ordinary prose. Choose A space instead.
How do I turn a list into one line separated by commas?
Choose Custom text and keep the default , . Each line is trimmed, empty lines are skipped and the lines are joined with the separator. For quotes around each item, as in an SQL IN list, use the comma separator.
Can I replace line breaks with an HTML <br> tag?
Yes. Choose Custom text and type <br>, or <br> followed by \n to keep each line on its own line in the result. Typing \n in the custom text inserts a real line break.
How do I remove line breaks in an Excel cell?
In Excel, =SUBSTITUTE(A1,CHAR(10)," ") replaces each line break in cell A1 with a space, and =CLEAN(A1) deletes them along with other nonprinting characters. Outside Excel, paste the text here and choose A space.
Is my text sent anywhere?
No. The tool runs in your browser and the text is not uploaded. It is kept in this browser tab only, so it is still there if you open another tool, and it is gone when you close the tab.