Whitespace Cleaner
Free to download on every platform. Comes pre-installed on BotFone, BotPad and BotFlip — with extra free apps included.
About this app
WHAT IT DOES
This tool cleans whitespace from text, helping you format and normalize text data. You paste or type text into the input area, choose your cleaning preferences, and the tool displays the cleaned result. It can trim leading and trailing spaces from each line, collapse multiple consecutive spaces into a single space, normalize line endings (converting CRLF to LF), remove empty lines, and even remove all whitespace entirely. The tool shows you how many original lines were processed and how many remain after cleaning, along with a preview of the cleaned text.
WHERE IT RUNS
Runs on any website—no per-site configuration needed. Works entirely in the browser, so your text never leaves your machine. The panel can be opened on any page, making it a convenient tool for developers, data analysts, writers, and anyone who needs to clean up text formatting quickly.
HOW TO USE
Install the userscript via BotGentz, then open the panel. Paste or type your text into the input area. Choose your cleaning settings: trim leading/trailing spaces, collapse multiple spaces into one, normalize line endings (CRLF to LF), remove empty lines, or remove all whitespace (which overrides other space-related settings). Click "Clean Whitespace" to process the text. The output shows the cleaned result with statistics. Use "Copy Result" to copy the cleaned text to your clipboard, or "Copy Input" to copy the original text. "Clear All" resets both input and output.
TECHNICAL MECHANISM
The tool processes text line-by-line using JavaScript's string methods. It first normalizes line endings by replacing \r\n and \r with \n using regular expressions. Each line is then processed individually: trim() removes leading and trailing whitespace if enabled, a regex replaces multiple spaces with a single space, and if "remove all whitespace" is enabled, all whitespace characters are stripped using \s regex. Finally, empty lines are filtered out if enabled. The original and cleaned line counts are tracked for display. The tool never uses innerHTML with user-provided text; all text is escaped using textContent to prevent XSS issues (PLAYBOOK-A §6 rule 3). Settings are saved locally via GM_setValue and persist across sessions.
THE PANEL
The floating panel is built with BotGentz's BGPanel framework. It is draggable—click and drag the panel header to reposition it anywhere on the screen. The panel remembers its position per site via the settings dropdown. It can be collapsed to a small bubble icon by clicking the minimize button, preserving screen space. The panel can be closed and reopened via the BotGentz toolbar. Press the Escape key to quickly close the panel. The panel automatically adjusts its layout for different screen sizes.
PLEASE NOTE
Requires the free BotGentz extension. This tool processes text entirely in your browser and does not send any data to external servers. Text is not stored or logged anywhere—only your settings are saved locally via GM_setValue. The tool is designed for moderate-sized text; very large text (100,000+ lines) may take a few seconds to process. Websites change frequently; if the tool stops working on a particular site, the script may need updating.