TEXT TOOL

Text Cleaner — Remove Line Breaks, Extra Spaces & Blank Lines

Paste messy text to remove line breaks, extra spaces, blank lines, and invisible characters in one step. Nothing is sent to a server.

About this tool

Text copied from a PDF, a webpage, or someone else's document often carries extra spaces, inconsistent line breaks, or invisible characters that aren't obvious until they cause a problem — a broken layout, a failed string match, or garbled formatting when pasted elsewhere. This tool strips that out, all in your browser.

How to use the Text Cleaner

  1. Paste your text into the input box.
  2. Choose which cleanup options you want applied.
  3. Copy the cleaned result — it updates as you type or toggle options.

What each option does

Remove extra spaces, blank lines, or every line break?

With the default options, pasted text like Hello   world becomes Hello world, and any spaces left dangling at the start or end of a line are trimmed away. Tick Remove blank lines as well to close up empty lines between paragraphs, so double-spaced text comes out single-spaced.

By default the cleaner keeps every line break, so each line stays on its own line. To rejoin text that was split into short lines, change Line breaks to one of the remove options described in the next section.

How to remove line breaks from text copied from a PDF

PDFs store text as positioned lines, not as flowing paragraphs, so copying from a PDF usually puts a hard line break at the end of every visual line. Pasted into an email or a form, the text then breaks in odd places. Choose Remove line breaks, keep paragraphs to fix it: within each paragraph, every line break (and any spaces around it) becomes one space, while a blank line still separates paragraphs. Windows line endings (CR LF) are handled the same way as plain LF.

For example, this pasted text:

This sentence was
split by a PDF
into short lines.

Second paragraph
starts here.

becomes two clean paragraphs: This sentence was split by a PDF into short lines. and Second paragraph starts here., still separated by a blank line. With Remove all line breaks it becomes a single line: This sentence was split by a PDF into short lines. Second paragraph starts here. If you also tick Remove blank lines, the keep-paragraphs mode gives one paragraph per line, which is handy for pasting into a spreadsheet column.

One limit to know: a word that the PDF hyphenated across two lines (such as exam- at the end of one line and ple on the next) is joined as exam- ple. The tool cannot tell a line-end hyphen from a real one like well-known, so it leaves hyphens alone; fix those few by hand or with Find & Replace.

Common use cases

Things to watch out for

"Collapse multiple spaces" and "Trim start/end of each line" both operate per line, so intentional formatting like a Markdown code block's leading spaces will also be flattened — turn those two off if you're cleaning up code or anything with meaningful indentation. Converting smart quotes is one-directional here (curly to straight); if you need straight quotes converted back to nice typographic quotes for a publication, that's a different, more context-dependent transformation this tool doesn't attempt.

Exactly which characters are changed

Hidden characters are hard to talk about because you can't see them, so here are the precise Unicode code points each option looks for.

OptionCharacters affectedReplaced with
Remove invisible charactersU+200B zero width space, U+200C zero width non-joiner, U+200D zero width joiner, U+FEFF byte order mark, U+00AD soft hyphenNothing (deleted)
Smart quotes to straightU+2018 and U+2019 (curly single quotes and apostrophe)U+0027 '
Smart quotes to straightU+201C and U+201D (curly double quotes)U+0022 "
Collapse multiple spacesTwo or more ordinary spaces (U+0020) in a rowOne space

The options run in a fixed order: invisible characters first, then quotes, then line trimming, then space collapsing, and finally blank-line removal. So a line that contains only a zero width space counts as blank once the invisible character is gone.

What it deliberately leaves alone

When removing invisible characters can change text

Most zero-width characters in pasted text are accidental, but two of them do real work in some content. The zero width joiner glues emoji together into a single picture: many family, profession and flag-style emoji are several emoji joined with U+200D, and removing the joiners splits them back into separate symbols. The zero width non-joiner is part of normal spelling in some scripts, including Persian and several Indian languages, where it controls how letters connect. If your text contains emoji sequences or those scripts, turn the invisible-character option off. Soft hyphens are safe to remove: they only mark where a word may break at the end of a line.

Frequently asked questions

How do I remove zero width spaces from text?

Paste the text and keep the Remove invisible/zero-width characters option on. It deletes zero width spaces (U+200B) along with zero width joiners and non-joiners, byte order marks and soft hyphens. The result looks identical on screen but no longer contains the hidden characters that break searches, string comparisons and form validation.

Does this remove non-breaking spaces?

Only at the start and end of lines, when Trim start/end of each line is on. Collapse multiple spaces matches ordinary spaces only, so non-breaking spaces (U+00A0) inside a line stay. To replace them everywhere, use Find and Replace with regex turned on, searching for \u00A0 and replacing it with a normal space.

Why did my emoji split apart after cleaning?

Many emoji, such as family groups, are several emoji joined by an invisible zero width joiner character. The Remove invisible characters option deletes that joiner, so the combined emoji falls apart into its separate pieces. Turn that option off when cleaning text that contains emoji and your other settings will still apply.

How do I remove line breaks but keep paragraphs?

Set Line breaks to Remove line breaks, keep paragraphs. Lines inside a paragraph are joined with a single space, and a blank line between paragraphs is kept. This is the usual fix for text copied from a PDF, where every visual line ends with a hard line break.

How do I put all text on one line?

Set Line breaks to Remove all line breaks. Every line break, including the blank lines between paragraphs, is replaced by a single space and the result is trimmed, so the whole text comes out as one line. Leading and trailing spaces around each break are absorbed too.