Remove Extra Spaces

Trim and normalize spaces.

Loading tool…

The whitespace you cannot see

Text collects whitespace as it moves between systems. Double spaces after full stops, a habit from typewriters that modern typography abandoned. Trailing spaces at the end of lines, invisible until they break a comparison. Blank lines left behind after deleting a paragraph. Tabs mixed with spaces after a copy from a spreadsheet.

There are also characters that look like ordinary spaces and are not. The non-breaking space,  , is inserted liberally by word processors and web editors and behaves differently in layout and in search. Zero-width characters can survive a copy from a web page entirely unseen. Cleaning text means collapsing runs of whitespace to single spaces, trimming line ends, normalising these lookalike characters, and reducing multiple blank lines to one.

Why we built this tool

The usual trigger is a paste that went wrong: content copied out of a PDF, a web page, or Word into a CMS, an email, or a code file, arriving with spacing that looks fine until it is published.

The text is nearly always unpublished — an article, a proposal, a client document — and there is no reason a whitespace cleanup should mean uploading it. Ours runs the transformation in your browser with no request at all, so nothing is transmitted or stored and there is no length limit. This is the same principle behind every tool on the site: if the browser can do the work, sending the data elsewhere is a cost with no benefit.

Tips and common mistakes

  • Non-breaking spaces look identical to normal ones and are what usually survives a cleanup.
  • Preserve indentation deliberately when the text is code or structured data.
  • Double spaces after full stops are a typewriter habit; single spacing is standard in digital typography.
  • Clean text before comparing two versions, or whitespace differences will dominate the diff.

Open Remove Extra Spaces with a link

Remove Extra Spaces can be handed its input by the link that opens it, so the page arrives with the work already done. This is meant for assistants and scripts: if a chatbot, an editor extension, or a command-line agent already holds your content, it can build a link instead of asking you to copy and paste into a box.

The payload rides in the fragment — the part of a URL after the #. Browsers never send the fragment to a server, so anything handed over this way stays on your device exactly as a dropped file would. A link that uses the query string instead is rewritten into the fragment by the page before any analytics or ad script can read the address.

Prefix any field with gz#gztext= — to pass it as gzip-compressed base64url, which fits roughly five to ten times more into the same link. Links stay reliable up to about 8,000 characters; past that, chat apps and address bars start truncating them, and the page says so rather than loading half a document.

One exception to the privacy rule: ?url= tells the page to download the input from an address. That request goes from your browser straight to that server — not through ours — but it does leave your device, and it only works if the server allows cross-origin requests.

  • #text= — the text to work on

Example: https://mygadgets.ink/tools/remove-extra-spaces/#text=...

Quick start: using Remove Extra Spaces

  1. Paste the text you need to clean.
  2. Choose which operations to apply — collapsing spaces, trimming lines, reducing blank lines.
  3. Run the cleanup and compare against the original.
  4. Check that intentional indentation, such as in code, survived.
  5. Copy the cleaned text into its destination.

For a full strip of styling as well as spacing, use Remove Formatting, then check the length with Word Counter.

Related Text Tools

Browse all Text Tools →