Remove Extra Spaces
Collapse extra spaces and clean up messy whitespace.
Fix messy spacing in one pass: collapse runs of spaces into one, trim each line, and optionally remove blank lines. Shows character counts before and after.
Loading tool…
If the tool stays on this message, make sure JavaScript is enabled, then reload the page.
About Remove Extra Spaces
Text copied out of a PDF, an email thread, or an OCR scan arrives with a special kind of damage: double spaces after every sentence, tabs where spaces should be, lines indented by accident, and blank lines scattered like confetti. It looks harmless, but paste it into a form, a document, or a website and the mess shows. This tool repairs all of it in one pass, collapsing every run of spaces and tabs into a single space, trimming leading and trailing whitespace from each line, and optionally deleting blank lines entirely.
The before-and-after character counts tell you at a glance how much damage there was and confirm the cleanup actually did something. Choose your options per job: trimming every line is right for pasted paragraphs, while removing blank lines is what turns a double-spaced paste into compact text. Line breaks themselves are never collapsed, so your paragraph structure survives the cleaning.
This is the first tool to reach for before any other text cleanup, normalizing whitespace first means deduping and sorting steps later behave predictably, since ' apple' and 'apple' stop being different lines. If your text needs the full treatment in one go, the text-cleaner tool bundles this step with blank-line and duplicate removal.
How to use Remove Extra Spaces
- Paste the text with messy spacing.
- Choose options such as trimming lines or removing blank lines.
- Copy the cleaned result.
Why use this tool?
- Collapses space runs to a single space
- Optional line trimming and blank-line removal
- Shows before and after character counts
Tips for best results
- Run this before deduping or sorting, normalized spacing stops ' apple' and 'apple' counting as different lines.
- Turn on blank-line removal for double-spaced pastes, but leave it off when paragraph breaks are intentional.
- Check the before/after counts; a tiny change means the text was already clean and your problem lies elsewhere.
- Use it on OCR output before proofreading, cleaning whitespace first makes real typos easier to spot.
- For code or markdown, copy the result back carefully, since indentation carries meaning there.