Whitespace Remover
Strip leading/trailing whitespace.
Overview
Strip whitespace from your text. Choose what counts: leading whitespace (left-trim), trailing whitespace (right-trim), both (full trim), interior runs collapsed to a single space, or every whitespace character removed entirely. The tool handles tabs, regular spaces, no-break spaces, and other Unicode whitespace characters.
Developers cleaning up pasted code, data analysts tidying up CSV cells, writers tightening sentences for a word limit, and editors normalizing inconsistent spacing across a document all reach for it. It's a small operation that turns up constantly in any text-cleanup workflow.
How it works
The tool identifies whitespace using the Unicode definition — not just ASCII space and tab, but also no-break space (U+00A0), zero-width space (U+200B), ideographic space (U+3000), and the rest of the white-space property. Depending on the mode, it strips characters at the start, end, or anywhere in each line.
"Collapse multiple spaces" mode replaces runs of two-or-more whitespace characters with a single space, useful when you want to keep words separated but lose double-spaces and stray indentation.
Examples
Input (with extra spaces):
' Hello World '
Trim: 'Hello World'
Collapse runs: 'Hello World'
Strip all: 'HelloWorld'
Input (per line trim):
' line one \n line two \n '
Output:
'line one\nline two\n'
FAQ
Does it handle Unicode whitespace?
Yes. No-break spaces, zero-width spaces, em spaces, and other less-common whitespace characters are recognized and stripped (or preserved) as configured.
Does it remove blank lines?
The basic trim mode preserves blank lines (they become empty lines). A separate option strips blank lines entirely if you want them gone.
What about leading whitespace inside string literals in code?
The tool treats the whole input as text — it doesn't know about syntax. If you only want to trim outside of strings, use a code formatter instead.