What the cleanup does
Three steps run in order. First, every run of two or more spaces, and every tab, becomes one ordinary space. Second, spaces at the start and end of each line are removed. Third, if the option is on, three or more line breaks in a row become two, which leaves exactly one empty line between paragraphs.
The example has three lines of text with extra spaces and tabs, separated by a gap of three blank lines, and trailing spaces at the end. After cleanup each line has single spaces, the gap becomes one empty line, and the character count drops from 139 to 120, so 19 extra characters were removed.
Which characters count as spaces
Besides the regular space, the tool treats tabs, the non-breaking space often pasted from web pages and word processors, and the other fixed-width spaces defined as white space in the Unicode Character Database as spaces. Each run of them becomes a single regular space. Line breaks are not touched by this step, so your lines stay separate.
Zero-width characters, which take up no visible room, are not removed, because they can carry meaning in some languages and emoji sequences. Characters are counted as they appear on screen, so an accented letter or an emoji with a skin tone counts as one character, and line breaks are not counted.
Paragraphs and blank lines
With the blank line option on, long gaps between paragraphs shrink to a single empty line, which is how most writing is laid out. Turn it off to keep blank lines exactly as they are, for example when spacing carries meaning in a poem or a template. To remove blank lines completely, use the remove empty lines tool.
Indentation at the start of a line is removed as part of trimming. If you need to keep indentation, such as in code or nested lists, this tool is not the right fit; tidy only the parts that need it.
When to use it
Extra spaces sneak in when text is copied from PDFs, emails, spreadsheets and web pages, or when it was typed with two spaces after each sentence. Cleaning them up before you paste into a document, a form or a database keeps formatting consistent and avoids matching problems in searches and lookups.
The counts show how many characters were removed, which helps when a field has a character limit. Up to 200,000 characters can be cleaned at once, and the text is processed on your device only.