Skip to content

Remove Line Breaks

Remove line breaks from copied text: join lines, keep paragraphs, delete empty lines, or use a comma or any separator.

  • Free
  • No sign-up
  • Runs locally

Remove Line Breaks tool

Runs in your browser; what you enter is not uploaded to our servers.

Updated · By

What this line break remover does

Paste text into the box and this tool removes line breaks instantly, turning ragged, chopped-up lines back into normal sentences. It is built for the moment when you copy a paragraph out of a PDF, a plain-text email or a terminal window and every line arrives as a separate line, ending mid-sentence.

There are five modes. Remove all line breaks joins everything into one block with single spaces. Keep paragraphs removes only the breaks inside paragraphs and keeps the empty line between them – the mode most people actually need for PDF and email text. Replace with… swaps each line break for a separator you choose, such as a comma, semicolon, pipe, tab or <br>. One line, no spaces glues lines together with nothing in between, which suits wrapped URLs, Base64 strings and Chinese or Japanese text where words are not separated by spaces. Delete empty lines keeps every line on its own line and deletes only the blank ones, for lists and data with gaps between the rows.

How to remove line breaks with this tool

  1. Choose a mode from the five cards at the top. Nothing needs to be submitted; the result updates live. In Keep paragraphs mode, a switch below the cards turns on Detect paragraphs without blank lines.
  2. Add your text. Paste it into the left box, press Paste, load a .txt, .md, .csv or .log file with Open .txt, or press Example to see a wrapped email with a bulleted list.
  3. Adjust the options below the stats if needed: collapse multiple spaces, trim each line, remove empty lines, keep list items on their own line, rejoin hyphenated words, and choose LF or CRLF for any breaks that remain.
  4. Check the numbers. The stat tiles show how many line breaks were removed (in Delete empty lines mode, how many empty lines), lines and characters before and after, and which line-ending style your input used. An emoji or accented letter counts as one character; a Windows CRLF break counts as two.
  5. Copy or download the result with the Copy or Download button above the result. Use result as input moves the output back into the left box so you can run a second pass with different settings.

How it works

The tool first splits your text at every kind of line break it can find: Windows CRLF, Unix LF, the lone CR used by classic Mac OS, the vertical-tab character Word uses for Shift+Enter, form feeds, and the Unicode line and paragraph separators.

Each line is then cleaned according to your options: leading and trailing spaces are trimmed and runs of spaces or tabs are collapsed to one. Blank lines at the very start and end are always dropped, so a trailing newline never leaves a stray separator. Finally the lines are joined again: with a space, with your separator, with nothing, or – in paragraph mode – with a space inside each paragraph and one empty line between paragraphs. A paragraph break is any line that is empty or contains only whitespace, so two, three or ten blank lines in a row all become exactly one. With Detect paragraphs without blank lines on, a short line that ends a sentence also ends a paragraph (see below). In Delete empty lines mode the lines are not joined at all: each one is kept on its own line and the blank ones are dropped.

Worked example

Input (5 lines, 4 line breaks, 74 characters):

The meeting moved to
Thursday at 3 pm.

Please bring the
signed contracts.
  • Remove all line breaks: The meeting moved to Thursday at 3 pm. Please bring the signed contracts. – 4 breaks removed, 73 characters.
  • Keep paragraphs: two lines separated by one empty line – 2 breaks removed, 2 kept, 74 characters.
  • Replace with… , (empty lines removed): The meeting moved to, Thursday at 3 pm., Please bring the, signed contracts. – 76 characters; useful for lists, clearly not for prose.

A line feed is one character (a Windows CRLF is two), so a break that becomes a space leaves the length unchanged. The count drops only when blank lines, doubled spaces or CR characters disappear – here, the one empty line.

Why unwanted line breaks appear

  • PDFs. A PDF places each line of text at fixed coordinates. It has no idea that line 3 continues line 2, so viewers insert a hard break at the end of every visual line when you copy.
  • Plain-text email. Many mail programs wrap plain-text messages at around 72–78 characters and insert real line breaks, and replies quote those lines again with > markers.
  • Terminal and log output. Man pages, command help and fixed-width reports are laid out for an 80-column screen with real line breaks at the wrap point, and some older consoles also add a break at every visual wrap when you copy.
  • OCR. Scanned documents are recognized line by line, and hyphenated words at line ends come through split in two.
  • Spreadsheet cells. A column copied from Excel or Google Sheets arrives as one value per line – exactly what you want in a list, and exactly what you do not want in a sentence.

Soft returns, hard returns, CRLF and LF

A hard return is what you get when you press Enter: it ends the paragraph. A soft return (Shift+Enter in Word or Google Docs) starts a new line but stays inside the same paragraph. Automatic word wrap is neither – it is just the display, and it vanishes when you change the page width. In plain text there are no paragraphs at all, only line-break characters, and the character depends on the system that saved the file.

NameCharactersCodeWhere you meet it
LF (line feed)\n10 (0x0A)macOS, Linux, Android, iOS, most source code and Git repositories
CRLF\r\n13 + 10Windows files, Notepad, CSV exports, many email protocols
CR (carriage return)\r13 (0x0D)Classic Mac OS files, some old exports
Vertical tab\v11Word's manual line break (Shift+Enter)
Paragraph markshown as ^p in WordWord's hard return, saved as CRLF in .txt

The tool treats all of these as line breaks. The "Input line endings" tile shows which one your text uses – handy when a script or Windows program misbehaves with a file. One catch: browsers convert every break to LF when you paste with Ctrl+V or type into a text box, so the tile reports the original endings only for files opened with Open .txt and text brought in with the Paste button.

Removing line breaks in Word, Google Docs, Excel and VS Code

You can do the same job inside most editors with find and replace. The syntax differs in each one:

ProgramFindReplace withNotes
Microsoft Word^p (paragraph mark) or ^l (manual line break)a spaceCtrl+H. Type a lowercase p or L, not the digit 1.
Google Docs\n with "Match using regular expressions" tickeda spaceEdit → Find and replace. How Docs matches paragraph breaks has changed over time; if nothing is found, paste the text here instead.
Excelpress Ctrl+J in "Find what"a spaceOr =SUBSTITUTE(SUBSTITUTE(A2,CHAR(13),""),CHAR(10)," ")
Google Sheets\n with "Search using regular expressions"a spaceOr =REGEXREPLACE(A2,"\n"," ")
VS Code\n with the regex button (.*) ona space"Join Lines" in the Command Palette also works (Ctrl+J on macOS).
Notepad++\r\n in Extended modea spaceOr Edit → Line Operations → Join Lines (Ctrl+J).

Excel's CLEAN function also strips line breaks, but it deletes them without adding a space, so "John" and "Smith" on two lines become "JohnSmith".

Deleting a single line break

Find and replace removes every break. To delete just one, make the breaks visible first. In Word, press Ctrl+Shift+8 (⌘8 on a Mac) or click the ¶ button on the Home tab: paragraph marks show as ¶ and manual line breaks as ↵. In Google Docs, choose View → Show non-printing characters. Then click at the start of the line after the break and press Backspace (the Delete key on a Mac). In an Excel cell, a break typed with Alt+Enter goes the same way: press F2 on Windows or double-click the cell, put the cursor at the start of the second line and press Backspace.

Fixing hard-wrapped text without losing paragraphs

The editors above remove every break, which flattens a multi-paragraph document into one wall of text. The classic Word workaround takes three passes: replace ^p^p with a placeholder such as ###, replace the remaining ^p with a space, then replace ### with ^p. It goes wrong when paragraphs are separated by a line that contains spaces (the ^p^p pair is never found) or by three returns (a stray space ends up at the start of the next paragraph).

Keep paragraphs mode does the same job in one step and tolerates messy input: blank lines that contain spaces, several blank lines in a row, and breaks of mixed types. Two extra options help with typical PDF text:

  • Rejoin hyphenated words turns exam- at the end of one line and ple at the start of the next into example. It only fires when the next line starts with a lowercase letter.
  • Keep list items on their own line keeps the break before lines that start with -, *, •, 1., 2), a) or (b), while still joining wrapped continuation lines of a long bullet.

Text with no blank lines between paragraphs

Some copied text has no blank lines at all: each paragraph simply starts on the next line. By default, paragraph mode then joins everything into one paragraph and says so. Switch on Detect paragraphs without blank lines to let the tool guess instead. It is a heuristic with one rule: a line ends a paragraph when it ends with ., !, ? or : (a closing quote or bracket may follow) and is shorter than 75% of the longest line in the text. Wrapped lines run close to the full width, while the last line of a paragraph usually stops short. Detection is skipped when the longest line is under 40 characters, because lines that short are not wrapped text. The rule also applies inside paragraphs that are separated by blank lines, so text that mixes both styles works. With Keep list items on their own line on, a line followed by a list item never ends a paragraph, because the item starts its own line anyway: a list of short sentences stays together, and its last item can still end the paragraph before the text that follows.

Input (4 lines, 3 line breaks, 148 characters; the lines are 50, 8, 45 and 42 characters long):

Our office will be closed on Monday for the public
holiday.
Deliveries booked for that day will arrive on
Tuesday instead, so please plan around it.

75% of the 50-character longest line is 37.5. holiday. is 8 characters and ends with a period, so it ends the first paragraph. The other lines either do not end a sentence or are too long. The result is two paragraphs with one empty line between them – 3 lines and 149 characters, with 1 line break removed (3 before · 2 after). Two breaks became spaces and the third became an empty line, which adds one character.

Because it is a guess, read the result. Three cases go wrong:

  • A full last line. When the last line of a paragraph happens to run nearly the full width, it is not short enough, and that paragraph is joined to the next one.
  • A list with the list option off. List lines are then text like any other. A short item such as - Your ID. or a line such as Please check: ends a paragraph, so empty lines appear inside the list or before it. Switch on Keep list items on their own line to keep the list together.
  • Ragged email text. When a long word or URL wraps to the next line, the line before it can fall below 75% of the longest line. If it also ends a sentence, the paragraph is split in the middle.

Where a paragraph was missed, add an empty line to your input; where one was split by mistake, join those two lines.

Removing empty lines but keeping each line

Sometimes the line breaks are fine and only the gaps are the problem. A list pasted from an email, PDF or spreadsheet often arrives with an empty line between the items, and CSV exports and log files can contain blank rows that trip up an import. Delete empty lines mode keeps every line on its own line and deletes only the blank ones. A line that holds only spaces or tabs counts as empty too. Nothing is joined, so the list and hyphen options do not apply, while Trim each line and Collapse multiple spaces still tidy the lines that stay. Windows CRLF breaks come out as LF unless you choose CRLF under "Line breaks in the result". A line break at the very end of the text is dropped as well, but it is not counted as an empty line.

Input (8 lines, 7 line breaks, 49 characters; the fourth line holds two spaces):

Order 1042

Order 1043
  
Order 1047


Order 1050

Result – 4 lines and 43 characters, and the tile shows 4 empty lines removed:

Order 1042
Order 1043
Order 1047
Order 1050

To delete repeated lines rather than blank ones, use remove duplicate lines; to sort what is left, use alphabetical order.

Who uses it

  • Students and researchers pasting quotations from journal PDFs into essays or reference managers.
  • Translators and editors preparing source text for CAT tools, where every hard break becomes a separate segment and ruins sentence matching.
  • Developers and data analysts turning a column of IDs into a comma-separated list for a SQL IN (…) clause, or joining a wrapped log line before searching it.
  • Marketers and social media managers removing breaks from copy that must fit a single-line field such as a meta description or an ad headline – then checking the length with the character counter.

Tips and common mistakes

  • Check hyphen joins. With "Rejoin hyphenated words" on, a genuine compound split at a line end, such as self- / control, loses its hyphen. Leave the option off for technical text full of compounds.
  • Numbered sentences can look like lists. A wrapped line that happens to begin with "12. " will be treated as a list item when list detection is on.
  • Use CRLF only when needed, for example for a Windows batch file or an older Notepad; LF is right for almost everything else.
  • Remove empty lines when using a separator, otherwise blank lines produce , , in the result.
  • Tidy other formatting next. After joining lines you may want to fix capitalization with the case converter or confirm the length with the word counter.

Privacy and limitations

Everything happens in your browser with JavaScript. Pasted text and opened files are never uploaded, and the draft is stored only in this tab's session storage so a refresh does not lose it; Clear or closing the tab removes it. Files up to 20 MB are accepted, including UTF-16 files saved by Windows Notepad as "Unicode". Inputs of several million characters work, though they take a moment to refresh after each change; for results over 200,000 characters the box shows a preview, while Copy and Download always include the full text. The tool works on plain text only: bold, italics and links from Word or a web page are lost when pasted, tables arrive as tab-separated cells, and scanned PDFs need to be run through OCR before their text can be copied at all.

Frequently asked questions

How do I remove line breaks but keep paragraphs?

Choose the “Keep paragraphs” mode. It joins lines that belong to the same paragraph with a space and keeps one empty line wherever your original text had an empty line (or several). This works whenever paragraphs are separated by a blank line, which is how most PDFs, emails and plain-text files are laid out. If only a single line break separates them, switch on “Detect paragraphs without blank lines”. This heuristic guesses paragraph ends from short lines ending in . ! ? or :, so check the result.

Why does text copied from a PDF have line breaks in every line?

A PDF stores text as positioned lines on a page, not as flowing paragraphs. When you copy it, most viewers insert a hard line break at the end of every visual line, so a paragraph of eight lines arrives as eight separate lines. The same happens with plain-text emails wrapped at about 72 characters, OCR output and terminal logs. Joining the lines within each paragraph restores normal text.

What is the difference between a soft return and a hard return?

A hard return (pressing Enter) ends a paragraph and is stored as a paragraph mark. A soft return (Shift+Enter in Word or Google Docs) starts a new line inside the same paragraph and is stored as a separate line-break character. The automatic wrapping you see when a line reaches the edge of the page is not a character at all – it disappears as soon as the text is resized.

What are CRLF and LF line endings?

They are the two common ways files mark the end of a line. Windows uses CRLF: a carriage return (CR, character 13) followed by a line feed (LF, character 10). macOS, Linux, Android and iOS use LF alone, and very old Mac software used CR alone. This tool recognizes all three, plus mixed files, so every break is removed no matter where the text came from.

How do I replace line breaks with commas?

Pick the “Replace with…” mode and choose the Comma + space preset, or type any separator you like, such as a semicolon, a pipe or <br>. Type \t for a tab. Keep “Remove empty lines” switched on so blank lines do not produce double commas. This is the quickest way to turn a column copied from a spreadsheet into a comma-separated list for an email, SQL query or tag field.

How do I remove line breaks in Microsoft Word?

Press Ctrl+H to open Find and Replace. Type ^p in “Find what” to match paragraph marks (hard returns) or ^l to match manual line breaks (Shift+Enter), type a space in “Replace with”, and click Replace All. To keep paragraphs, first replace ^p^p with a placeholder such as ###, then replace ^p with a space, then replace ### with ^p. To delete one break, press Ctrl+Shift+8 to show the ¶ and ↵ marks, click just before the mark and press Delete.

Will removing line breaks break bulleted or numbered lists?

Only if you let it. Switch on “Keep list items on their own line” and any line starting with a bullet (-, *, •) or a list number (1., 2), a), (b)) keeps the break before it, while wrapped continuation lines are still joined. Lines that merely begin with a number followed by a period can be mistaken for list items, so glance over the result.

Is my text sent to a server?

No. The line breaks are removed by JavaScript running in your browser, and files you open are read locally without being uploaded. Your text is kept only in this browser tab’s session storage so a refresh does not lose it; closing the tab or pressing Clear removes it. Your preferred mode and options are remembered in local storage; they contain none of your text.

Guides on this topic

All guides
All text tools

Published · Updated · Built and tested by · How we test

Found a bug or have an idea? Tell us