Remove Extra Spaces
Collapse repeated spaces.
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
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?
Does it remove line breaks?
Why is there still a space at the start of a line?
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 YouTubeHTML in 100 Seconds
Fireship
Quick HTML mental model next to text transform tools.
Watch on YouTube
- Unicode Normalization Forms
Unicode
Why seemingly identical characters break equality checks.
- RFC 3629 — UTF-8
IETF
UTF-8 rules behind character-counting tools.