Remove Extra Spaces and Blank Lines from Text
Text copied from PDFs, emails and websites often carries double spaces, ragged indentation, piles of empty lines and invisible characters. Choose what to clean and get tidy text back, with a count of every fix applied.
How to clean up whitespace
- Paste your text into the left box.
- Tick the clean-up steps you want: collapse spaces, trim lines, replace non-breaking spaces, remove zero-width characters or join lines within paragraphs.
- Choose how blank lines and tabs should be handled.
- Review the change counts, then copy or download the cleaned text.
Invisible characters that break text
Not every space is a normal space. Non-breaking spaces (U+00A0) come from web pages and word processors and stop searches and spreadsheet formulas from matching. Zero-width spaces and byte-order marks are completely invisible yet make two identical-looking strings different. This tool replaces the former with ordinary spaces and deletes the latter, while leaving the zero-width joiner inside emoji such as ๐ฉโ๐ป intact. "Join lines within paragraphs" fixes text copied from PDFs, where every visual line ends in a hard line break. To compare the result with the original, paste both into the Text Diff Checker.
Benefits
- Each operation can be switched on or off and reports exactly how many changes it made.
- Removes invisible zero-width and non-breaking spaces that other cleaners miss.
- Rejoins hard-wrapped PDF text into flowing paragraphs while keeping paragraph breaks.
Limitations
- Collapsing spaces also affects intentional alignment, such as ASCII tables or code indentation โ turn that option off for code.
- Joining lines cannot tell a hard-wrapped sentence from a deliberate list, so check bulleted lists after using it.
Privacy and security
All clean-up runs in your browser with JavaScript. The text is not uploaded anywhere or kept after you close the page.
Read our privacy policy for details about the site as a whole.
Frequently asked questions
How do I remove line breaks but keep paragraphs?
Turn on "Join lines within paragraphs". Lines inside a paragraph are joined with single spaces, and blank lines between paragraphs are kept as paragraph breaks.
Why do I still see double spaces after a full stop?
Make sure "Collapse repeated spaces" is ticked. If the gap remains, it may be a non-breaking space next to a normal one; enable "Replace non-breaking spaces" as well.
Does this change tabs in my code?
Only if you choose to convert tabs to spaces. With "Keep tabs" and "Trim each line" off, indentation is preserved.