Remove extra spaces

Trim leading and trailing spaces, collapse double spaces and clean up whitespace in one click.

Clean up:
Input
Output
Send output to:

Ctrl + L clear  |  Ctrl + Shift + C copy output

About whitespace in text

Whitespace is every character you cannot see: spaces, tabs, and the invisible trailing characters at line ends. Because it is invisible, it is where text problems hide. A search that fails to match, a spreadsheet column that will not sort, a username rejected as "already taken" — the culprit is often a stray space nobody can see. Typography has fought over whitespace too: the double space after a period was correct practice in the typewriter era, when monospaced type needed the extra gap, and modern style guides from Chicago to AP have spent decades stamping it out now that proportional fonts make single spacing correct.

Why extra spaces appear in text

Extra spaces are extremely common when working with copied text. PDFs often add extra spaces between words due to their internal character spacing system. Spreadsheet exports sometimes pad cells with trailing spaces. Copying from websites that use justified text alignment can introduce multiple spaces between words. Old documents created before modern word processors sometimes used double spaces after periods, which is now considered outdated style.

In programming and data processing extra spaces are a frequent source of bugs. A database field with a trailing space will not match a query looking for the exact string. A CSV file with leading spaces in column values will import incorrectly. Cleaning whitespace before working with data is a standard step in any data pipeline.

What each option does

Double spaces collapses any sequence of two or more consecutive spaces into a single space. This is the most commonly needed option and handles both double spaces after periods and spaces introduced by PDF formatting. Leading spaces removes any spaces or tabs at the very start of each line — useful for text that was indented in the source document but should be flush left in its new destination. Trailing spaces removes invisible spaces at the end of each line which cause problems in databases and code editors. Tabs to spaces converts tab characters into single spaces giving you consistent whitespace throughout.

Frequently asked questions

How do I remove double spaces from my text?

Paste the text above with the Double spaces option enabled and every run of two or more consecutive spaces collapses to a single space instantly — whether it came from old typing habits, PDF extraction or justified web text. This beats fixing it in a word processor, where you must run find-and-replace on " " repeatedly until no matches remain, because triple and quadruple spaces need multiple passes there. Here one pass handles any length of space run.

What does trimming whitespace mean?

Trimming means removing invisible characters — spaces and tabs — from the beginning and end of text or of each line, while leaving the visible content untouched. It is one of the most common operations in programming (most languages ship a trim() function) because untrimmed input breaks things quietly: "alice@example.com " with a trailing space fails login checks, and a padded spreadsheet cell will not match its unpadded twin. The Leading spaces and Trailing spaces options perform exactly this per-line trim.

Will removing extra spaces affect my paragraph formatting?

No. The tool operates only on space and tab characters — line breaks and the blank lines between paragraphs pass through untouched, so your document keeps its structure. Cleaning happens within each line: multiple spaces collapse, line-edge spaces are trimmed, tabs convert. If you also need to fix broken line structure — say, a PDF paste with a hard break after every line — run the text through the remove line breaks tool as a second step.

Should I type one space or two after a period?

One. The two-space rule was correct on typewriters, whose monospaced characters made sentences blur together without extra separation, and generations of typing classes taught it. Proportional digital fonts solved that spacing problem, so every major modern style guide — Chicago, AP, APA, MLA — now specifies a single space. If a document you inherited is full of double sentence spacing, the Double spaces option converts all of it to modern single spacing in one pass.

Can I remove tabs as well as spaces?

Yes. Enable Tabs to spaces and every tab character converts to a single space, which matters because tabs and spaces look identical on screen but behave differently — a tab pastes into a spreadsheet as a column separator and renders at unpredictable widths in different editors. Converting them gives text one consistent, predictable kind of whitespace. Each cleanup option toggles independently, so you can convert tabs while leaving indentation alone, or vice versa.