Phrasit

Search Phrasit

Search every tool, guide, and citation page.

FREE · COLLAPSE · TRIM · TIDY · NO SIGNUP

Remove extra spaces

Collapse runs of double spaces into one, trim the whitespace off every line, drop blank lines, convert tabs and invisible non-breaking spaces, and clean the stray space before punctuation. Each fix is a toggle, and the whole thing runs in your browser, no upload.

0 whitespace characters removed

Cleanup options

About the Remove extra spaces

Remove extra spaces cleans up the whitespace that creeps into text from copying, merging documents, and converting between formats. It collapses runs of repeated spaces into one, trims the spaces hanging off the start and end of each line, optionally deletes empty lines, turns tabs into single spaces, removes the stray space before punctuation, and converts non-breaking and zero-width spaces into ordinary ones so they stop behaving invisibly.

Extra whitespace is more than an eyesore. Double spaces throw off justified text and word counts, trailing spaces show up as phantom characters in code and CSV files, non-breaking spaces copied from web pages refuse to wrap and break search and find-and-replace, and inconsistent indentation makes pasted lists look messy. This tool fixes all of those in a single pass, with each transform toggleable so you only apply what the text needs.

How to use it

  1. Paste the text with messy spacing into the input box.
  2. Leave the default options on for a general tidy, or toggle individual transforms such as remove empty lines or trim lines to match your text.
  3. Read the cleaned result on the right; the counter shows how many whitespace characters were removed.
  4. Use the remove-blank-lines option when you want to compress a list or table that has gaps between rows.
  5. Click Copy to take the cleaned text, or Clear to load something new.

Examples

Fix double spaces after sentences

An older document uses two spaces after every full stop, the typewriter convention. With collapse-spaces on, every double space becomes a single one, and because the space-before-punctuation option is also on, any stray space sitting before a comma or period is removed too, bringing the text in line with modern single-space style.

Clean web-copied non-breaking spaces

Text pasted from a web page contains invisible non-breaking spaces that stop it wrapping and break your find-and-replace. The NBSP option converts every one of them to a normal space, so the text wraps correctly and your search for a normal space now finds them.

Frequently asked questions

What is a non-breaking space and why remove it?
A non-breaking space looks like a normal space but tells software not to wrap or collapse it. It is common in text copied from web pages and word processors. It causes trouble because it does not match a normal space in searches and prevents wrapping, so converting it to a regular space restores expected behaviour.
Does it remove single spaces between words?
No. It only collapses runs of two or more spaces down to one. The single spaces that separate words are left untouched, so your sentences stay readable. To remove all spacing you would use the remove line breaks tool's concatenate mode, not this one.
Will it delete the indentation in my code?
Trimming lines removes leading and trailing spaces, which will flatten indentation, so turn that option off if you are cleaning code and want to keep the structure. The tab-to-space option also affects indentation, so leave it off for source code where tabs are meaningful.
Can it remove empty lines too?
Yes, with the remove-empty-lines option. It deletes any line that contains nothing but whitespace, which is useful for compressing a list or a table that has blank rows between entries. It is off by default because many documents use blank lines deliberately to separate paragraphs.

Good to know

Order matters when several whitespace fixes run together, and the tool applies them in a deliberate sequence: it normalises the exotic spaces first, then tabs, then collapses runs, then removes the space before punctuation, then trims each line, and finally drops blank lines if asked. Running them in that order means a line that mixes a tab, a non-breaking space, and several normal spaces ends up as one clean space rather than a partial mess that needs a second pass.

Decide what counts as extra before you clean. For prose, collapsing spaces and trimming lines is almost always safe and correct. For code, configuration files, and anything where indentation or alignment is significant, be selective: keep trim and tab conversion off so you do not destroy meaningful structure. When in doubt, clean a copy and compare it against the original, and pair this with the remove line breaks tool if the text also has unwanted hard returns, since spacing and line-break problems usually travel together.

Related tools