Text Whitespace Remover allows you to paste any text and pick the operations you want: convert tabs to spaces (or vice versa) at a given tab width, change line endings between Unix LF, Windows CRLF and old-Mac CR, or strip trailing whitespace from every line. This online whitespace cleaner also lets you collapse runs of spaces into a single space, ensuring your code or prose is perfectly formatted.
Useful when prepping a code snippet for a blog post (no trailing whitespace, consistent indentation), normalising a file pasted from Windows for use on a Linux server, or fixing the inevitable mixed-tab-and-space indentation in a Python file. This space remover tool can be configured for any reasonable tab width (1 to 16); two and four are the most common for developer tasks.
PEP 8 recommends 4 spaces. Most Python projects (and Black, the formatter) enforce 4. Use 2 for JavaScript / Ruby projects that follow that convention.
LF (\n) is Unix and modern macOS. CRLF (\r\n) is Windows. CR (\r) was classic Mac OS up to version 9 - rarely seen today but sometimes shows up in legacy files.
Yes - collapse-runs-of-spaces is a blunt tool that affects everything, including string contents. Use it on prose, not code, unless you're sure no quoted whitespace matters.
If your input starts with a BOM (U+FEFF), the output won't include one. The tool always emits BOM-less UTF-8.
Whether you are cleaning up a messy script or formatting an email, this free online text whitespace remover provides a simple, browser-based solution.