Updated · Built and checked by the PlinzoTools team, formulas tested against published sources
Trim leading/trailing whitespace and collapse extra spaces from every line.
Hello World
Extra spacesThis tool cleans up messy whitespace in text -- trimming leading/trailing spaces from every line and collapsing internal runs of multiple spaces or tabs down to a single space -- while leaving line breaks intact.
Paste text with inconsistent spacing. The cleaned-up version appears instantly.
Each line is processed independently: leading and trailing whitespace is trimmed, and any run of consecutive spaces or tabs within the line is collapsed to a single space. Line breaks themselves are preserved, so the overall paragraph/line structure stays intact.
For removing entirely blank lines instead of just extra spaces, see the Remove Empty Lines Tool.
Suppose you paste two lines: the first is three spaces, the word Hello, four spaces, the word World, and two trailing spaces. The second is a tab, then Extra, three spaces, then spaces, and finally the word here. After processing, the first line reads "Hello World" and the second reads "Extra here". Leading and trailing spaces disappear on each line, and every internal run of spaces or tabs becomes one space. The line break between them stays exactly where it was.
The cleanup is applied to every line, and the tool as built always collapses internal spaces along with the edge trimming. Some descriptions of this kind of tool mention a separate switch for turning collapsing off, but you should verify what the interface in front of you offers before relying on it. If you must keep intentional internal alignment, such as columns padded with spaces, do not run that text through this tool, since the columns would be flattened.
Keep the original text somewhere while you experiment, since the output replaces nothing until you copy it. Compare the result to the input visually, especially at the beginnings of lines. If you also want blank lines gone, follow up with the Remove Empty Lines Tool. Because the function works line by line, a very long single line is trimmed at its two ends and collapsed inside, but it is never wrapped or split.
No -- only spaces and tabs are collapsed/trimmed; line breaks between lines are always preserved so the text's paragraph structure stays intact.
Yes -- leading whitespace (including code indentation) is trimmed from each line, so this tool isn't suited for cleaning up code where indentation is meaningful; use it for prose or data text instead.
No -- there is no toggle. Collapsing internal runs of spaces and tabs always happens along with the edge trimming. If you need to keep intentional internal spacing, this tool is not the right fit.
The gap probably contains non-breaking spaces or other special characters rather than regular spaces or tabs, and the collapsing step only handles regular spaces and tabs.
No. Blank lines are kept. A line that contains only spaces becomes an empty line, but it is not deleted.
Generally not, because leading indentation is removed from every line, which breaks indentation-sensitive languages and makes code harder to read.
Reference: MDN Web Docs