TTKTheTextKit

Whitespace Remover

Paste text copied from PDFs, web pages, emails or Word documents to clean up extra spaces, tabs, non-breaking spaces, invisible characters and surplus blank lines. The tool collapses repeated spaces into one, trims each line, limits blank lines to one in a row and tells you what it found. You can keep indentation for code, choose how many blank lines to keep, or remove all whitespace. Your original wording stays intact.

Related Tools

[3 suggestions]

Guides for the Whitespace Remover

About the Whitespace Remover

The Whitespace Remover treats every kind of space as whitespace, not only the space bar and the tab. Text copied from web pages and word processors often carries non-breaking spaces (U+00A0), thin and em spaces, ideographic spaces and zero width spaces that look like normal gaps but defeat a simple search for a double space. In tidy mode the tool turns each run of these into one ordinary space, trims the ends of every line, keeps at most the number of blank lines you choose (one by default) and removes blank lines at the start and end. It also removes the zero width space, the word joiner and the byte order mark, which are invisible but are not whitespace, while leaving the zero width joiner and non-joiner alone because emoji and several scripts need them. You can switch each step off, keep the indentation of code and lists, or remove all whitespace, with or without the line breaks. The line ending of your text, LF or CRLF, is kept, and the tool lists what it found, such as the number of non-breaking spaces, before you copy the result. Your text stays in your browser.

Does this remove all line breaks?▾

No. In tidy mode it keeps your paragraph breaks and limits blank lines to the number you choose, one by default. Choose Remove all whitespace without Keep line breaks, or use the Remove Line Breaks tool, to join the lines.

Will it remove leading and trailing spaces from each line?▾

Yes, unless you tick Keep indentation. That option leaves the spaces and tabs at the start of each line and trims only the end, which suits code and nested lists.

What is a non-breaking space and why remove it?▾

A non-breaking space (U+00A0) looks like a normal space but stops a line from wrapping there. Web pages and word processors insert them often, and they break searches, comparisons and imports that look for a normal space. The tool turns them into ordinary spaces.

Does it remove invisible characters?▾

By default it removes the zero width space, the word joiner and the byte order mark. It leaves the zero width joiner and non-joiner, because emoji such as a family and some writing systems need them.

How many characters does the cleanup typically save?▾

The tool shows how many characters were removed and lists what it found, so you can see the difference. Text copied from PDFs or Word documents often has a noticeable share of extra whitespace.