Whitespace Cleaner
Related external sites
Some links are affiliate links.
Related tools
Tidy up messy text by removing extra whitespace. Trim each line, collapse runs of spaces into one, clean up blank lines and convert tabs to spaces. It is ideal for fixing text copied from PDFs, websites or emails. Everything runs in your browser.
How to use
- Paste your text into the box.
- Choose which cleanups to apply with the checkboxes.
- Copy the cleaned result; the before/after sizes are shown.
How it works
The text is normalized to standard line breaks, then each enabled cleanup runs in turn: tabs become spaces, runs of spaces collapse to one, each line is trimmed, and blank lines are either collapsed to a single blank or removed entirely. Trailing spaces at the end of lines are always removed.
Features
Trim lines
Remove leading and trailing spaces from every line.
Collapse spaces
Turn multiple spaces or tabs into a single space.
Blank line control
Collapse repeated blank lines into one, or remove them all.
Tabs to spaces
Convert tab characters to a set number of spaces.
Before & after
See the character and line counts before and after cleaning.
When to use it
Cleaning pastes
Fix text copied from PDFs or web pages that brings messy spacing.
Pre-format code
Strip trailing spaces and stray tabs before formatting code.
Tidy writing
Remove double spaces and extra blank lines from a draft.
Prep data
Normalize spacing before importing or parsing text.
Notes
- Trailing spaces at line ends are always removed.
- Line endings are normalized to LF.
- Full-width (ideographic) spaces are left untouched.
- Everything runs on your device; nothing is uploaded.
FAQ
- Does it remove full-width spaces?
- No. It targets regular spaces and tabs. Full-width (ideographic) spaces are left as-is; use a width converter if you need to change those.
- Can I keep blank lines?
- Yes. Leave both blank-line options off to keep them, use collapse to reduce repeats to one, or remove to delete them all.
- What happens to tabs?
- Turn on Tabs to spaces to convert each tab to spaces; otherwise tabs are left in place (but collapsed if space-collapsing is on).
- Does it change line endings?
- Yes. It normalizes Windows and old Mac line endings to standard LF newlines.
- Is my text sent to a server?
- No. All cleaning happens locally in your browser.