Skip to content
1001 Tools
sr
Text tools

Remove Extra Spaces

Paste messy text and get it back with the whitespace tamed: runs of spaces collapsed to one, line edges trimmed, and — if you want — blank lines removed. It also catches the invisible troublemakers: non-breaking and zero-width spaces that ride along when you copy from Word, PDFs or web pages.

Cleaned text

How it works

Three independent switches control the cleanup. Collapsing replaces any run of spaces and tabs with a single space; trimming cuts whitespace from the start and end of every line; the blank-line option removes lines that contain nothing (or only whitespace). Each does one thing, so you can, say, keep paragraph breaks while still fixing double spaces.

The collapse step first normalizes exotic spaces — the non-breaking space (nbsp), thin space, figure space and zero-width space. These look identical to a normal space on screen but break search, comparisons and CSV imports. PDFs and Word documents are their usual source.

The counter above the result tells you how many characters were removed — a quick sanity check that the cleanup did what you expected before you copy the result out.

Practical examples

Text copied from a PDF

PDF extraction is notorious: line-end hyphens, non-breaking spaces, trailing whitespace on every line. Paste, keep the two default options on, and the copy-ready version appears immediately.

A document written with double spaces after periods

The two-spaces-after-a-period habit survives from typewriter days. Collapse turns every double space into one across a whole manuscript in a single paste.

Preparing lines for a spreadsheet

Trailing spaces make “Novi Sad ” and “Novi Sad” different values in Excel and databases. Trimming line edges before pasting prevents duplicate rows that are impossible to spot by eye.

Compacting a chat log

An exported conversation is full of empty lines between messages. Enable “remove blank lines” to compress it to one message per line for archiving or analysis.

Frequently asked questions

What is a non-breaking space and why should I care?

A character (U+00A0) that looks like a space but forbids line wrapping — common in Word and PDF text. It breaks text comparison and search: “Novi Sad” with an nbsp will not match the same text with a normal space. This tool converts them to regular spaces during collapsing.

Will the cleanup merge my paragraphs?

Not unless you ask it to. Collapsing and trimming never touch line breaks; only the “remove blank lines” option affects them — and it removes only fully empty lines, which does merge paragraph spacing. Leave it off to preserve structure.

Does it remove spaces inside the text I actually want?

Single spaces between words are never touched. Only runs of two or more spaces/tabs are collapsed to one, so normal prose passes through unchanged.

What about tabs?

Tabs are treated as spaces during collapsing: a tab or several become one space. If you need tab-separated data to keep its tabs, turn collapsing off and use only trimming.

Can it fix indentation in code?

It will remove the indentation, which is rarely what you want for code — collapsing and trimming destroy leading whitespace that Python or YAML depend on. Use a code formatter for code; this tool is for prose and data.

How do I remove ALL spaces, not just extras?

That is deliberate scope: this tool normalizes, it does not strip. To delete every space, use the Find and Replace tool with a single space as the search term and an empty replacement.

Does it handle Windows line endings (CRLF)?

Yes. Both CRLF and LF inputs work, and trimming removes stray carriage returns at line ends, which also fixes the “invisible character at end of line” problem in some editors.

Is the text processed on a server?

No — everything runs in your browser, instantly on every keystroke. Nothing is uploaded, logged or kept.

Related tools