Remove Line Breaks Online

Join wrapped lines, preserve paragraphs, remove blank lines, and collapse extra spaces with a private whitespace remover.

Private: Processing happens locally in your browser. No text or file is uploaded. Clearing the tool or closing this page removes the working text.

0 characters · 0 words · 0 lines · 0 whitespace characters

You can also load a plain-text file. Its contents remain on this device.

Drop a .txt file here or

The file is read only in your browser.

2. Choose how to join lines
Replace joined breaks with
More options

Check structured text carefully. Line breaks and indentation may be meaningful in code, YAML, Markdown, poetry, addresses, JSON strings, and other structured data.

0 characters · 0 words · 0 lines · 0 whitespace characters

The original stays unchanged so you can compare it with the result. Select text in this box normally, or use Copy result.

Original

Cleaned

Add text and select Clean text to see what changed.

Keyboard tip: Ctrl/Cmd + K focuses the input. Ctrl/Cmd + Enter cleans it.

Advertisement

Try an instant example

Fix wrapped PDF prose

Before
A PDF may wrap text
in the middle of a sentence.

A new paragraph stays separate.
After
A PDF may wrap text in the middle of a sentence.

A new paragraph stays separate.

Make a comma-separated list

Before
apples
pears
oranges
After
apples, pears, oranges

Remove extra spaces and blank lines

Before
First   line



Second    line
After
First line

Second line

What the whitespace remover does

Text copied from PDFs, Word documents, websites, emails, and spreadsheets can contain hard wraps and invisible formatting. This tool normalizes Windows CRLF, old Mac CR, and Unix LF line endings before applying the options you select. Preserve paragraphs is useful for PDF prose: it joins visual line wraps inside each paragraph while keeping blank-line boundaries.

Whitespace in plain language

  • Line break: starts the next line. A single break is often an unwanted hard wrap in copied PDF text.
  • Paragraph break: a blank line separating two blocks of text.
  • Tab: an indentation character that can look like several spaces.
  • Non-breaking space: U+00A0 or narrow U+202F, often copied from Word or the web; it prevents wrapping but usually looks like a normal space.
  • Zero-width character: an invisible U+200B, U+200C, U+200D, or U+FEFF character that may appear in pasted web text.

Suggested workflow

  1. Paste, type, drop, or choose a local .txt file.
  2. Keep Preserve paragraphs for prose, or choose Join all lines for a list or form field.
  3. Select a space, comma, or custom separator and adjust More options if needed.
  4. Select Clean text, compare both fields and statistics, then copy or download the result.

Processing rules and literal examples

The join mode controls line breaks; More options control the other characters. In these examples, means a line break, means a tab, and · means a normal space.

Input itemJoin all linesPreserve paragraphsRelevant option
Single line breakone⏎two → one·twoone⏎two → one·twoSpace, comma, or custom separator
Blank lineone⏎⏎two → one·twoone⏎⏎two → one⏎⏎twoRemove blank lines overrides preservation
Several blank linesone⏎⏎⏎two → one·twoone⏎⏎⏎two → one⏎⏎twoCollapse multiple blank lines
Tabone⇥⇥two → one·twoCollapse repeated spaces and tabs
Repeated spacesone···two → one·twoCollapse repeated spaces and tabs
Leading/trailing whitespace·one· → oneTrim each line
Non-breaking spaceone[NBSP]two → one·twoConvert non-breaking spaces
Zero-width characterone[ZWSP]two → onetwoRemove zero-width characters
Any whitespaceone·two⏎three → onetwothreeRemove all whitespace overrides join settings

Frequently asked questions

Is my text uploaded?

No. Text and local .txt files are processed only in your browser and are not sent to Starlight Tools. Clearing the tool or closing the page removes the working text.

How does Preserve paragraphs work?

It joins single line breaks inside each paragraph using your selected separator, while keeping blank-line paragraph boundaries. With Collapse multiple blank lines enabled, every paragraph boundary becomes one blank line.

How do I replace line breaks with commas or custom text?

Choose Comma or Custom separator under Replace joined breaks with. Enter any custom text you need, then select Clean text.

Why does copied PDF text have hard line breaks?

PDFs often store text by its visual lines rather than as flowing paragraphs. Copying can preserve those line endings, so sentences wrap in the wrong places.

What is the difference between removing spaces and removing all whitespace?

Collapsing spaces keeps one normal space between words. Remove all whitespace deletes spaces, tabs, and line breaks, so words run together.

Is there a text-size limit?

There is no fixed server limit because nothing is uploaded. The practical limit depends on your browser and device memory, and very large files may process more slowly.

Does it work on mobile?

Yes. The tool, local file picker, copy action, and download action work in modern mobile browsers, subject to browser permissions.

Can cleaning damage code or JSON?

Yes. Line breaks, spaces, and indentation can be meaningful in code, JSON strings, YAML, Markdown, poetry, addresses, and other structured text. Compare the result before using it.

Explore more tools