Remove Extra Spaces

Collapse double spaces, trim the start and end of each line, convert tabs and remove empty lines — all in one pass.

🔒 Runs in your browser — your text is never uploaded.Shortcuts: / search · Ctrl/⌘ + Enter main button

How to use the Remove Extra Spaces

  1. Paste your text.
  2. Choose which kinds of whitespace to clean.
  3. The cleaned text appears instantly.
  4. Copy or download the result.

Example

Input
  Too    many   spaces  here.  
Result
Too many spaces here.

What gets cleaned up

  • Collapse multiple spaces: runs of spaces and tabs inside a line become a single space.
  • Trim each line: spaces at the start and end of every line are removed, and so are leading and trailing spaces for the whole text.
  • Convert tabs to spaces: tab characters become normal spaces.
  • Empty lines: keep them all, keep at most one blank line in a row, or remove them all.

The tool also treats special space characters, such as non-breaking spaces and wide spaces, as ordinary spaces. After cleaning it tells you how many whitespace characters were removed.

Where extra spaces come from

Double spaces often come from typing two spaces after a full stop, from copying text out of PDFs and web pages, and from justified text in emails. Indentation and tabs creep in when you copy from code, tables and spreadsheets. They make text look uneven and can break matching and imports.

Settings for common jobs

  • Clean prose: leave everything on and choose “Max one in a row” for empty lines, so paragraphs stay separated.
  • Prepare a list: choose “Remove all” empty lines to get one item per line with no gaps.
  • Keep indentation: turn off “Trim each line” and “Collapse multiple spaces” if leading spaces carry meaning, as they do in code.
  • Tidy copied PDF text: first join the broken lines with the Remove Line Breaks, then run this tool.

Related cleanup tools

To delete repeated lines after cleaning, use the Remove Duplicate Lines. To strip unwanted symbols, try the Remove Special Characters, and to find and replace words in bulk use the Find and Replace.

Frequently asked questions

Does it remove non-breaking spaces?

Yes. Non-breaking spaces and other Unicode space characters are treated as regular spaces and collapsed.

Will it change my words or punctuation?

No. It changes only spaces, tabs and blank lines. Letters, numbers and punctuation stay as they are.

How do I keep the indentation of my code?

Turn off “Trim each line” and “Collapse multiple spaces”. Then only tabs and empty lines are affected.

Learn more

More tools you may like