Remove Extra Spaces From Text

Collapse double spaces, runs of spaces and stray tabs into a single space — line breaks are kept. Handy for text copied from PDFs, emails and websites.

Runs in your browserUpdated
Result

Your data never leaves your computer. All processing happens 100% locally in your browser.

How to use the Remove Extra Spaces

  1. Paste your text — the rule that collapses repeated spaces is already set.
  2. Check the count of replacements and the highlighted spots.
  3. Copy the cleaned text.

What the rule does

The pattern [ ]{2,} finds two or more spaces or tabs in a row and replaces them with one space, without touching line breaks. To also trim spaces at the start and end of lines, add a second rule: ^[ ]+|[ ]+$ → (empty).

Joining broken lines too? Use Remove Line Breaks.

Also searched as: remove double spaces, remove multiple spaces, collapse whitespace, clean up spaces, remove spaces from text.

Tools that pair well with the Remove Extra Spaces

  • Find and Replace — Paste text and replace words or patterns — case-sensitive or not, whole words only, or with regular expressions and $1 capture groups.
  • Remove Empty Lines — Delete every empty line — including lines with only spaces or tabs — from lists, code, logs and CSV files.
  • Remove Duplicate Lines — Paste a list to remove duplicate lines instantly.
  • Word Counter — Paste or type your text to count words and characters live — plus reading and speaking time, keyword density and length checks for SEO titles, meta descriptions and social posts.

Frequently asked questions

Are line breaks removed?
No — only spaces and tabs are collapsed. Use Remove Line Breaks to join lines.
Can I remove all spaces?
Change the Find pattern to s+ (or a single space) and leave Replace empty.
Is my text private?
Yes. Cleaning happens in your browser.
Can I install Remove Extra Spaces as a web app and use it offline?
Yes. Remove Extra Spaces is an installable web app (PWA) — installed from your browser, not downloaded from an app store. Click Install app at the top of this page in Chrome or Edge (Windows, macOS, Linux, ChromeOS) or on Android, use Share → Add to Home Screen on iPhone and iPad, or File → Add to Dock in Safari 17+ on a Mac. It then opens in its own window with its own icon, and because it runs entirely in your browser it keeps working offline. Firefox on desktop can’t install web apps. How installing works.

Related tools