EthicalFusion

Remove Extra Spaces

Collapse multiple spaces and trim each line.

Was this tool helpful?

Thanks for the feedback!

Remove Extra Spaces squeezes every run of spaces and tabs down to a single space and strips the spaces at the start and end of each line. Line breaks and blank lines stay where they are, so a multi-line address, list or invoice keeps its shape while the ragged spacing inside it is fixed.

The two rules applied to your text

  1. Collapse: any sequence of spaces and tab characters becomes one ordinary space. A single tab is also converted to a space.
  2. Trim each line: spaces before the first word and after the last word of every line are removed, which also removes indentation.

Nothing else is touched. Line breaks, blank lines, punctuation and letter case remain as they were. Non-breaking spaces (U+00A0) and other special Unicode spaces are not treated as spaces by this tool, which explains most "why are there still gaps" surprises.

Before and after

  Invoice   No:    INV-2291
	Amount:		₹ 12,500

   Due  date:  15 March

becomes

Invoice No: INV-2291
Amount: ₹ 12,500

Due date: 15 March

The tab-indented "Amount" line lost its tabs, the double spaces inside "Due date" were reduced, and the empty line between them survived.

Where messy spacing comes from

  • PDFs and justified text: copying from a justified column often produces two or three spaces between words.
  • Typing habits: two spaces after a full stop is a typewriter-era convention many people still follow.
  • Tables and aligned plain text: columns lined up with spaces in emails, bank statements or code comments turn into long gaps when pasted elsewhere.
  • OCR output: scanned documents converted to text frequently contain irregular gaps.

Extra spaces cause real problems. "New Delhi" with two spaces does not match "New Delhi" in a search, a spreadsheet VLOOKUP or a duplicate check. Excel's TRIM function applies similar logic inside a sheet, and like this tool it leaves character 160, the non-breaking space, alone. It is also a sensible step before comparing two versions of a document, since whitespace differences otherwise show up as changes.

Limits to keep in mind

  • Indentation is removed. Do not run Python, YAML or any file where leading spaces are part of the syntax through this tool.
  • Non-breaking spaces stay. If gaps remain, they are probably U+00A0; use find and replace in a text editor to swap them for normal spaces, then run the tool again.
  • Single stray spaces stay. In Hello , world the space before the comma is only one space, so it is not changed; fix those with find and replace.
  • Lines are not joined and blank lines are not removed. For those jobs use Remove Line Breaks or Remove Empty Lines; the Text Cleaner combines spacing fixes with blank-line reduction in one step.

Frequently asked questions

Does it remove the spaces between words?
No. It reduces each gap to exactly one space, so words stay separated.
Will it delete my line breaks or blank lines?
No. Only spaces and tabs are affected, so the line structure of your text is preserved.
Why are some double spaces still there after cleaning?
They are most likely non-breaking spaces copied from a web page or Word file. The tool only collapses normal spaces and tabs.
Is it safe to use on Python or YAML code?
No. It strips leading spaces from every line, which destroys the indentation those languages depend on.
What happens to tab characters?
Every tab, or run of tabs and spaces, is replaced by a single ordinary space.

Related tools

Embed this tool on your site

Paste it into any blog or website. Free, with a credit link.