Remove Line Breaks

Paste text, pick a replacement, keep paragraphs intact if you want, and copy the cleaned result. Runs in your browser.

Remove Line Breaks Delete Spaces soon Online Text Cleaner soon Blank Line Remover soon Strip Whitespace soon
Input Load sample

How to use the line break remover

1. Paste the text

Drop the text with unwanted line breaks into the Input box. Paste from a PDF, an email, a code editor, a Kindle export, or anywhere else. The tool reads Unix, Windows, and Mac line endings without any setup. If you want to check overall length before and after, run the result through the Word Counter in a separate tab.

2. Pick a replacement

Each line break becomes whatever you choose: a single space (default, fine for prose), a comma + space (good for list-to-row conversion), a period + space (when each line is a self-contained sentence), nothing at all (concatenate), or a custom string (anything from a pipe to an emoji).

3. Set the toggles

Three toggles control edge cases. Preserve paragraph breaks treats two or more newlines as a paragraph boundary and only collapses single newlines. Trim each line first strips leading and trailing whitespace per line so you do not end up with double spaces. Collapse multiple spaces runs at the end so the result never contains runs like "word word".

4. Clean and copy

Click Clean. The output appears on the right with a count of how many line breaks were removed. Use the Copy button to grab the result, or Download to save a .txt file.

When you need to remove line breaks

Line breaks pile up whenever text crosses a format boundary. Here are the most common cases. See also: remove commas.

PDF copy-paste
PDFs use page-width line breaks that survive copy. Pasting into Word or Notes leaves you with a ragged column. Replace single newlines with a space, keep paragraph breaks on, and the text reflows to your destination width.
CSV one-cell preparation
Spreadsheets treat a newline inside a quoted field as a line break inside the cell, which breaks downstream tools. Flatten the field to one line first (turn paragraph preservation off) before pasting into the cell.
JSON string preparation
JSON strings cannot contain raw newlines. Strip them out (or replace with \n as a literal) before pasting into a JSON value. Keep collapsed spaces on to avoid weird whitespace inside the value.
Blog post cleanup
Drafts written in a fixed-width editor (vim, plain TextEdit) often hard-wrap at 72 columns. Paste into your CMS and you get ladder-shaped paragraphs. Replace single newlines with a space, keep paragraph breaks.
Kindle copy reformatting
Highlights exported from Kindle land with hard breaks every 40 to 50 characters. Strip the breaks to read the quote as one continuous sentence before pasting into a citation.
Email signature flattening
Multi-line signatures (Name / Title / Company / Phone) need to go on one line for a bio field or social profile. Use comma + space as the replacement and the four lines become a single comma-separated string. For dedicated list-to-row conversion, jump to column to comma-separated.
Code-comment cleanup
Long block comments wrapped to 80 columns get hard to refactor when you want to rewrap to 100 or 120. Strip the line breaks, then re-wrap in your editor at the new width.

Soft vs hard line breaks explained

Most people use the words "line break" and "newline" interchangeably, but there are actually two different things going on. The distinction matters when you copy text between programs.

A soft line break is what your editor does automatically when text reaches the edge of the visible page. The text wraps to the next line because there is no more horizontal room, not because the file contains a real newline character. Resize the window and the wrap point moves. Soft breaks are not stored in the file.

A hard line break is a real character in the file, inserted when you press Enter or when an export pipeline writes one explicitly. Hard breaks survive copy-paste. They are the ones this tool removes.

Different operating systems write hard breaks with different characters:

EncodingBytesOriginUsed by
LF (Line Feed)\nUnix, 1970Linux, macOS (post-10), most modern editors
CRLF (Carriage Return + Line Feed)\r\nWindows / DOS, inherited from teletypesWindows Notepad, .txt files exported from Word, .csv files
CR (Carriage Return)\rClassic Mac OS, pre-2001Old Mac files, some legacy exports

This tool normalizes all three before processing, so you do not need to know which one is in your text. Once line breaks are removed, your destination editor handles soft wrapping on its own. For broader whitespace hygiene (extra spaces, tabs, zero-widths), pair this page with remove whitespace.

Browse all text removers to compare related tools - comma remover, duplicate-line stripper, HTML-tag remover, and more.

Frequently asked questions

How do I remove line breaks from text I copied from a PDF?

Paste the PDF text into the input box. Leave the default replacement as a single space and keep the Preserve paragraph breaks toggle on. Click Clean. The output joins lines inside each paragraph while keeping paragraph boundaries intact, which is what most PDF copy-paste workflows need.

What is the difference between a soft line break and a hard line break?

A soft line break is automatic word-wrap done by your editor when text reaches the edge of the page. It is not a real character in the file. A hard line break is an explicit newline character (\n on Unix and Mac, \r\n on Windows) inserted when you press Enter. This tool removes hard line breaks. Soft breaks rewrap automatically once the underlying newlines are gone.

Does the tool preserve paragraph spacing?

Yes, when the Preserve paragraph breaks toggle is on. A paragraph boundary is detected as two or more newlines in a row. Only single newlines inside a paragraph are collapsed. Turn the toggle off if you want the whole input flattened to one line.

Can the tool handle Windows (CRLF) and Mac (CR) line endings?

Yes. The tool normalizes all three common newline forms before processing: LF (Unix and modern Mac), CRLF (Windows), and CR (classic Mac). You do not need to pre-clean the file.

Will the tool change my line endings in the output?

After cleaning, the output uses LF (\n) as the paragraph separator when paragraph preservation is on, or no line breaks at all when it is off. If you need a specific line ending for a target system (CRLF for Windows tools, for example), open the cleaned text in your editor and convert there.

I'm pasting copy out of a PDF report and out of internal Slack threads to unwrap the line breaks. Does that content go anywhere?

No. Line-break stripping happens in your browser. Whatever you paste from a PDF, a Slack thread, or any other source stays inside this page, with no upload step and no log entry.

How do I turn a multi-line list into a comma-separated string?

Paste the list. Select Comma + space as the replacement. Turn the Trim each line toggle on to remove stray indentation. Turn Preserve paragraph breaks off so every line joins into one row. Click Clean and copy the result into your spreadsheet, CSV, or code. If that is your only use case, the dedicated column to comma-separated tool ships with that conversion as the default. The inverse operation - stripping commas from a string - lives at remove commas.

Why are there double spaces in my output?

If a line ended with a trailing space, joining lines with a space produces two spaces in a row. Turn on the Collapse multiple spaces toggle, or the Trim each line toggle, to fix this. Both run before the join step.

Related tools

Comma Remover soon
Free comma remover. Strip every comma from text, swap commas for spaces or newlines, keep commas inside num...
Delete Duplicate Words soon
Remove repeated words from text. Per-line, per-sentence, or whole-text scope. Free online duplicate-word re...
Character Count
Free online word counter - instantly count words, characters, sentences, paragraphs, and reading time. AI-p...

More wordcounter.ai tools

Other tools you might find useful.

Browse the full catalog →