Visualize Spaces and Tabs in Text
Learn how to reveal spaces and tabs in your text. Identify tabs-vs-spaces issues in code, configuration files, and Makefiles with visual markers.
Detailed Explanation
Spaces vs Tabs: The Eternal Debate
One of the most common whitespace issues in software development is the mixing of spaces and tabs for indentation. While many modern editors handle this gracefully, problems arise when files are shared across different editors, copied from web pages, or when strict formatting rules apply (as in Makefiles and YAML).
How the Visualizer Shows Them
The Whitespace Visualizer replaces each regular space with a middle dot (·) and each tab character with a right arrow (→) followed by the tab stop. This makes it immediately obvious which character is used for indentation.
Why It Matters
| Context | Problem |
|---|---|
| Makefiles | GNU Make requires actual tab characters before recipe lines. Spaces cause "missing separator" errors. |
| YAML | Tabs are not allowed in YAML indentation at all. A stray tab causes parse failures. |
| Python | Mixing tabs and spaces in indentation causes IndentationError or TabError. |
| Git diffs | Mixed indentation makes diffs noisy and code review harder. |
| EditorConfig | Teams enforce consistent indent_style (space or tab), and violations slip in from copy-paste. |
Detecting the Mix
Paste your code into the tool and enable both Space and Tab toggles. Scan the left margin of your code: you should see either all dots or all arrows. If you see a mix, the tool's statistics panel shows exact counts so you can decide which to normalize.
Cleaning Up
Use the Clean section to select Tab (to replace with spaces) or Space (in rare cases), then click Clean to apply. For more advanced text transformations, the Text Case Converter can change naming conventions in your identifiers.
Use Case
A developer receives a Python file from a colleague and gets IndentationError. They paste it into the Whitespace Visualizer and discover that three lines use tabs while the rest use spaces. They clean the tabs, copy the fixed code, and the error disappears.