How to remove line breaks
- Paste your text into the box on the left, or press Open a file to load a .txt file. The example shows the usual problem: a line break at the end of every line and a word cut in two with a hyphen.
- The fixed text appears on the right while you type. By default the lines inside each paragraph are joined with a space and the paragraphs stay apart, because a blank line marks where one paragraph ends.
- To make the whole text a single line, choose All line breaks (one line) under Remove.
- To put something other than a space where each line break was, choose it under Replace each line break with: nothing, a comma, an HTML
<br>tag or your own text. - Press Copy and paste the result where you need it, or Download .txt to keep it as a file.
Why copied text is full of line breaks
PDFs. Most PDFs are built to look the same on every screen and printer, so each line of text is stored at its place on the page, not as flowing paragraphs. When you copy from a PDF, the end of every line comes along as a line break, and a word that the program split to fit the line arrives as two halves with a hyphen. Pasted into an email or a document, the text then breaks in odd places as soon as the width changes.
Emails. The email standard asks for lines of no more than 78 characters, so many mail programs wrap plain-text messages at about that width when they send or quote them. Copying such an email gives you short lines with a break at each end.
Web pages, code and terminals. Text copied from a fixed-width source, such as a terminal window, a code comment or a text file wrapped by hand, keeps the line breaks the writer typed.
The kinds of line break
A line break is not a visible character, but it is stored in the text like any letter. Computers have used three ways to mark one, a leftover from typewriters, where the carriage return moved the paper back to the left edge and the line feed rolled it up one line:
- LF (line feed, character 10, written
\n): used by Linux, macOS, Android and iPhone. - CR LF (carriage return then line feed,
\r\n): used by Windows text files and many internet protocols. - CR (carriage return alone,
\r): used by Mac computers before Mac OS X, which came out in 2001.
This tool understands all three, as well as the rarer Unicode line separator and paragraph separator characters, so text from any computer is handled the same way. The result uses line feeds, which every modern program reads.
What each option does
- Line breaks inside paragraphs joins lines that belong to the same paragraph. A line that is empty or holds only spaces counts as the gap between two paragraphs.
- Join words split by a hyphen fixes words broken at the end of a line. A line ending in a letter and a hyphen is joined straight to the next line when that line starts with a small letter, so “para-” and “graph” become “paragraph”. Before a capital letter or a digit the hyphen is kept and the halves are joined without a space, so “Jean-” and “Paul” become “Jean-Paul” and “2020-” and “2021” become “2020-2021”. Invisible soft hyphens, which some programs put where they split a word, are always joined.
- Tidy spaces turns tabs, runs of spaces and no-break spaces into one ordinary space and takes the spaces off both ends of each line, so the joined text never has double spaces.
- Keep list items on their own lines starts a new line for each line that begins with a bullet (•, ◦, -, *), a number such as
1.or2), or a letter such asa), so lists survive while the text around them is joined.
Removing line breaks in Word, Excel and other programs
- Microsoft Word: open Replace (Ctrl+H). Type
^pin Find what to find paragraph marks, or^lfor manual line breaks, and a space in Replace with. Replacing every^palso joins your real paragraphs, which is why a tool that keeps blank-line gaps is often quicker. - Excel: to remove line breaks inside cells, open Find and Replace (Ctrl+H), click in Find what and press Ctrl+J to enter a line break, then type a space in Replace with. With a formula,
=SUBSTITUTE(A1, CHAR(10), " ")does the same for one cell. - Google Sheets: the same formula works:
=SUBSTITUTE(A1, CHAR(10), " "). - Notepad++: open Replace, set Search Mode to Extended, find
\r\n(or\n) and replace it with a space.
When removing line breaks helps
- Quoting a PDF in an essay, a report or a slide, so the quotation flows like normal text.
- Pasting into forms and social posts that keep every line break, such as job applications, product listings and bios.
- Turning a column into one line: paste a column of names or codes from a spreadsheet and replace the line breaks with commas to get a list for an email or a search box.
- Preparing text for translation, reading aloud or a word count: broken lines can make sentences look like separate items. Clean text works better with the text to speech reader and the word counter.
- HTML: choose the
<br>tag to keep the line breaks visible in a web page, where a plain line break would show as a space.
To delete repeated lines rather than line breaks, use remove duplicate lines. To change capital letters, try the case converter, and to sort the lines, alphabetical order.
Tips
- Check the paragraph count. The message under the buttons says how many paragraphs were kept. If the whole text came out as one paragraph, the PDF had no blank lines between paragraphs; add an empty line where each paragraph should end and they are kept apart.
- Watch for real hyphens. Words such as “self-aware” that happen to break at the hyphen lose it when joined. Untick Join words split by a hyphen if your text has many of them, then fix the few split words by hand.
- Make a single line for code and data. Choose All line breaks and Nothing to join a long key, link or block of characters that was wrapped across lines.
Your text stays on your device
The line breaks are removed in your browser, and your text is never uploaded to this website or anyone else, so it is safe to use with private emails and documents. Only your settings are remembered on this device; the text is gone when you close the page.
Frequently asked questions
How do I remove line breaks from text?
Paste the text into the box and the result without line breaks appears next to it straight away. Press Copy to paste it anywhere, or Download .txt to save it. Choose “Remove all line breaks” to make the whole text one line.
How do I keep paragraphs but remove the other line breaks?
That is what the default setting does. A blank line marks the end of a paragraph, so the lines inside each paragraph are joined and the paragraphs stay apart. Choose “One line break” under “Between paragraphs” if you want them without an empty line between them.
Why does text copied from a PDF have line breaks everywhere?
Most PDFs store each line of text in its place on the page, without a record of where sentences and paragraphs flow. When you copy, every line ending becomes a line break. This tool joins those lines back into paragraphs.
What happens to words split with a hyphen at the end of a line?
With “Join words split by a hyphen” ticked, a line ending in a letter and a hyphen is joined to a next line that starts with a small letter, so “exam-” and “ple” become “example”. Words that really contain a hyphen at that point, such as “well-known”, lose it too, so untick the box for text full of those.
Can I replace line breaks with commas or something else?
Yes. Under “Replace each line break with”, choose a space, nothing, a comma and space, an HTML <br> tag, or your own text. Choosing a comma turns a column of names into a single comma-separated line.
Is my text uploaded?
No. The text is changed in your browser and is never sent to this website or anyone else. Only your settings are saved on this device; the text itself is not kept.