← All tools/Utilities/Text/Whitespace Remover
Whitespace Remover
Remove extra spaces, blank lines or all whitespace from pasted text.
Characters removed
How it works
Modes: Collapse spaces: runs of whitespace → one space, ends trimmed. Remove blank lines: lines with nothing but whitespace are dropped. Remove all whitespace: every space, tab and newline is deleted. Trim each line: leading and trailing whitespace removed per line. Characters removed = input length − output length.
Worked example: “Hello world” followed by two blank lines and “ Foo ” is 23 characters. Collapse spaces gives “Hello world Foo” (15 characters, 8 removed); remove all whitespace gives “HelloworldFoo” (13 characters, 10 removed); remove blank lines gives 21 characters (2 removed); trim each line gives 19 characters (4 removed).
Frequently asked questions
What counts as whitespace?
Spaces, tabs and line breaks. This tool only removes whitespace — it never changes letters, numbers or punctuation.
Which mode should I use?
Collapse spaces for pasting text into a single line, remove blank lines to tidy a list, trim each line to clean up pasted code, and remove all whitespace only when spaces must go entirely, such as in a single token.
Will it join words together?
Only in remove-all-whitespace mode, which deletes every space. Collapse mode replaces each run of whitespace with one space, so words stay separate.
Does it work on code?
Yes, but carefully: removing all whitespace breaks most code. Use trim-each-line or remove-blank-lines for code, and keep a copy of the original.
Is my text sent anywhere?
No. Everything happens in your browser; nothing is uploaded or stored.
More tools
Tell us what you think
Loving this tool, or stuck on something? Tell us — it takes a minute.
We’ll only use your name and email to reply if needed. The tool and page are filled in for you.