About this whitespace/trim tool
Collapse extra whitespace and trim your text. Consecutive JavaScript whitespace characters become a single ordinary space, then leading and trailing whitespace is removed. Work directly with your own text in this browser without signing in or uploading a document. Review the result before copying it into another application, and use Reset to clear the workspace when you are finished. The examples below show the exact behavior to expect, while the limitations explain cases where another workflow may be more suitable.
How it works
Consecutive JavaScript whitespace characters become a single ordinary space, then leading and trailing whitespace is removed.
Try these examples
a b
a b
a b
a b
Limitations & privacy
Line breaks, tabs and nonbreaking spaces are collapsed too. Do not use this to preserve code indentation. Maximum text input: 100,000 UTF-16 units.
Inputs and results stay in this browser. Only tool identifiers are stored for your recently used tools. You can clear that history from the directory.
A few good questions
How does this tool handle my input?
Consecutive JavaScript whitespace characters become a single ordinary space, then leading and trailing whitespace is removed.
Does my text leave this browser?
No. Processing runs locally; tool input and results are not uploaded or included in analytics.
What should I check before using the result?
Line breaks, tabs and nonbreaking spaces are collapsed too. Do not use this to preserve code indentation.
Updated September 19, 2026