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, strip trailing whitespace from every line, or collapse runs of spaces into a single space. All operations apply in one pass and are completely safe to combine.
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. The tab width can be set to anything reasonable (1 to 16); two and four are the most common in practice.
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.
Explore the full suite of Text tools and 290+ other free utilities at Chunky Munster.