Whitespace Remover

How to Remove Extra Spaces from Text

You pasted text from a PDF or website and now there are double spaces everywhere. Here is how to fix it — instantly online, or in Word, Google Docs, and Excel.

Why extra spaces appear

PDFs store text with precise character positioning rather than clean spacing — when you copy from a PDF, the spacing data turns into literal space characters. Web pages use HTML entities and non-breaking spaces. Spreadsheets pad cell values. And some people still type two spaces after a full stop from the typewriter era.

The result: text that looks fine visually but has two, three, or more spaces between words when you paste it anywhere.

Method 1: Online tool (fastest)

Go to quicktoolshub.org/whitespace-remover. Paste your text, enable Collapse spaces and Trim edges, click Remove Whitespace, and copy the result. Takes about 10 seconds.

Method 2: Microsoft Word

  1. Press Ctrl+H (Windows) or Cmd+H (Mac) to open Find & Replace
  2. In Find what: type two spaces
  3. In Replace with: type one space
  4. Click Replace All
  5. Repeat until the count shows 0 replacements

Method 3: Excel — TRIM function

In an empty column next to your data, enter =TRIM(A1) and press Enter. Excel's TRIM removes leading and trailing spaces and collapses internal spaces to one. Drag the formula down, then copy the cleaned column and paste as values.

Method 4: Python

import re

# Remove leading/trailing spaces
clean = text.strip()

# Collapse multiple spaces to one
clean = re.sub(r' +', ' ', text)

# Remove ALL spaces (including internal)
clean = ' '.join(text.split())  # also trims and collapses

Remove extra spaces now

Paste text, collapse spaces, copy the clean result. Free, no sign-up.

Use Whitespace Remover →

Frequently asked questions

How do I remove extra spaces from text online?

Use the free Whitespace Remover at quicktoolshub.org/whitespace-remover. Paste your text, enable 'Collapse spaces', click Remove Whitespace, and copy the clean output. It reduces any number of consecutive spaces to a single space — instantly, in your browser, with no sign-up.

How do I remove extra spaces in Microsoft Word?

Open Find and Replace (Ctrl+H on Windows, Cmd+H on Mac). In the Find field, type two spaces. In the Replace field, type one space. Click Replace All. Repeat until no double spaces remain. Alternatively, use Find and Replace with a regular expression: find ' +' (two or more spaces) and replace with ' ' (one space) after enabling regex mode.

How do I remove extra spaces in Google Docs?

Google Docs does not have built-in regex Find and Replace. The easiest method is to copy the text, paste it into the Whitespace Remover at quicktoolshub.org/whitespace-remover with 'Collapse spaces' enabled, then copy the result back into your document.

Why does my text have extra spaces?

Extra spaces most commonly appear when copying text from PDFs (which store positioning data, not clean text), from web pages (which use HTML spaces), from spreadsheets (which pad cell values), or from code editors. They can also come from manually pressing the space bar twice after a period — a habit from the typewriter era.

How do I remove extra spaces in Excel?

Use Excel's built-in TRIM function: in an empty cell, type =TRIM(A1) where A1 is the cell with extra spaces. This removes leading and trailing spaces and reduces internal multiple spaces to one. To apply to a whole column, enter the formula in the first cell and drag it down. Then copy and paste as values to replace the originals.

How do I remove spaces from text in Python?

For leading and trailing spaces: use str.strip(). For multiple internal spaces: use ' '.join(text.split()) which splits on any whitespace and rejoins with single spaces. For all spaces: use text.replace(' ', ''). For regex-based collapsing: import re and use re.sub(r' +', ' ', text).