Remove Extra Spaces

Collapse repeated spaces.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Paste text with doubled spaces or stray tabs and press Run. Every run of spaces and tabs becomes one space, and your line breaks are kept.

How to use

1
Step 1
Paste the text into Input.
2
Step 2
Press Run.
3
Step 3
Copy the cleaned text.

How it works

Any run of whitespace that is not a line break is replaced by a single space. Spaces at the start or end of a line also collapse to one space rather than disappearing, so run Trim Whitespace afterwards if you want them gone.

Worked example

Pasted PDF text

Input
Hello world again next line
Output
Hello world again next line
Walkthrough
Four spaces, two spaces and a tab each become one space. The leading and trailing spaces on the second line are reduced to one, not removed.

Limitations

  • Does not remove spaces at line ends; use Trim Whitespace for that.
  • Does not remove blank lines.

Questions

How do I remove double spaces?
Paste the text and press Run. Any run of spaces becomes a single space.
Does it remove line breaks?
No. Lines stay separate.
Why is there still a space at the start of a line?
Leading spaces are shortened to one. Run Trim Whitespace to remove it.

Features

  • Collapses spaces and tabs
  • Keeps line breaks
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • HTML Crash Course For Absolute Beginners

    Traversy Media

    Text on the web often starts as HTML you clean or count.

    Watch on YouTube
  • HTML in 100 Seconds

    Fireship

    Quick HTML mental model next to text transform tools.

    Watch on YouTube