Remove Extra Spaces
Collapse double spaces, strip trailing whitespace and tidy blank lines in text pasted from PDFs, emails or web pages.
Everything you type here is processed on your own device. No input is sent to a server, logged, or stored.
What the Remove Extra Spaces tool does
Use this remove extra spaces tool to collapse double spaces, strip trailing whitespace and tidy blank lines in text pasted from PDFs, emails or web pages. Paste your text in, pick the options you need, and copy the result straight back out. It is most often used for cleaning text copied from a PDF before reusing it. More utilities in this area are collected on FreeToolStation.org.
How to use it
- Paste the messy text.
- Pick what to clean — "Everything" handles the usual PDF-paste mess.
- The cleaned version appears below.
- Copy it into your document.
How it works
The "everything" mode does four things: collapses runs of spaces and tabs into a single space, strips leading and trailing whitespace from every line, reduces three or more consecutive newlines to a paragraph break, and trims the whole text. Line breaks are preserved, so paragraph structure survives.
This is the usual fix for text copied out of a PDF, where every line arrives with its original layout indentation baked in, and for text pasted from an email client that has added quote markers and wrapping.
The "remove all whitespace" mode is different in kind — it produces one unbroken string. That is for cases like cleaning a base64 blob or a hash that has been wrapped across lines, not for prose.
When to use it
- Cleaning text copied from a PDF before reusing it.
- Normalising spacing in a document written by several people.
- Removing indentation from text pasted out of a code editor.
Common mistakes to avoid
- Using "remove all whitespace" on prose, which runs every word together.
- Cleaning code with this tool — indentation is syntactically meaningful in Python and YAML.
Frequently asked questions
Will it remove line breaks?
No. Single and double line breaks are preserved so paragraphs survive. Only runs of three or more blank lines are reduced. Use the remove line breaks tool if you want to join lines into one block.
Does it handle non-breaking spaces?
The "remove all whitespace" mode does. The other modes target regular spaces and tabs; non-breaking spaces pasted from a web page are left alone because they are often there deliberately.