Whitespace Cleaner
Remove the spaces you don't want. Keep the indentation, line endings and characters you do.
This tool processes text locally in your browser. No account or text upload is needed.Choose what to clean
Paste text below or import a .txt file. Choose your cleanup options, then select Process text to see the cleaned result beside your original.
Order: replace tabs → leading trim → trailing trim → collapse spaces → remove empty lines → normalize endings → final-ending policy. Only ASCII spaces and tabs are cleaned. Blank classification follows earlier transformations.
Exactly-one final ending also removes terminal blank lines; empty output remains empty. Tab replacement is a fixed number of spaces, not tab-stop alignment.
Before
0 / 2,097,152 UTF-8 bytesMaximum input: 2 MiB UTF-8. Output: 16 MiB. Process is manual; input over 32 KiB uses a cancellable local worker. Editing or changing rules clears outdated results.
After
Textareas display endings as LF. The visual marks show their original type; copy and download use the exact processed text, not the preview or decorations.
- Original UTF-8 bytes
- 0
- Result UTF-8 bytes
- Pending
- Original lines
- Pending
- Result lines
- Pending
- Lines removed by empty-line filter
- Pending
- Tabs replaced
- Pending
- Leading spaces/tabs removed
- Pending
- Trailing spaces/tabs removed
- Pending
- Repeated-space runs collapsed
- Pending
- Extra spaces collapsed
- Pending
- Line endings normalized
- Pending
- Final endings removed / added
- Pending
Drafts stay in memory only. Refresh clears them. Nonbreaking spaces, other Unicode whitespace, letters and combining characters are not normalized.
How to use Whitespace Cleaner
Keep the original ASCII cleaner for trimming, fixed tab replacement, empty-line handling, line-ending policies, visual marks, counts, copy/download and Undo. Enable the additional workflow for explicit Unicode conversions, configurable tab stops, protected blocks, scoped cleanup and multiple text files.
Paste or edit the selected input, or choose 1–10 UTF-8 files. Advanced settings hold Code, Prose and CSV-safe presets, ordinary cleanup switches, Unicode groups, block rules and regex scopes. Apply a preset before preparing; later changes create your own combination of rules.
Prepare the batch and inspect every file’s warnings and line-level before/after diff. Whole-block protection preserves markers and line endings. Indentation-only rules preserve original leading ASCII spaces/tabs. Ordered rules do not nest; an unclosed rule protects the rest of the file. Regex regions stay within original lines and zero-width matches do not select characters. Ending and empty-line changes require All text scope.
Review formatting warnings before downloading changed text or building the complete ZIP. The audit includes settings, checksums, filenames and complete changed lines; previews may be shortened. Named profiles save only settings and patterns, load only when requested and never include text-file contents. Closing Advanced preserves all choices.
Example: clean text around a protected block
Try the additional example. It contains a Python-style line, an explicitly selected nonbreaking space and a block between BEGIN KEEP and END KEEP. The whole block stays unchanged, while eligible text outside it follows the selected rules. Review the indentation warning and the audit before exporting.
Tab-stop expansion advances to the next configured code-point column. Preserved indentation can retain tabs; wide characters and combining marks may occupy different display widths. Choose fixed replacement if that is the transformation you intend.
About whitespace and format-sensitive text
Whitespace can separate words, align code or form part of data. Unicode includes nonbreaking, wide and line-separating characters, so the additional workflow names each selected conversion. Unselected zero-width spaces and BOM characters remain unchanged. See the Unicode character-property data.
The CSV-safe preset makes no content changes because spaces, tabs and quoted line breaks can be field data. It does not infer which changes your CSV consumer allows; see RFC 4180. Code warnings are heuristics, not language parsing or a guarantee that a transformation preserves meaning. Complex regex patterns can time out without publishing partial output.
Stars and feedback
Loading…
What should we improve next?
Help shape the next update to Whitespace cleaner. Tell us what would make it better for you.
Prefer email? feedback@tooltulip.com
Tool reference #043