Whitespace Visualizer

Show invisible characters — spaces, tabs, line endings, and trailing whitespace.

Hello·World¶
→	Indented·with·tab¶
··Two·spaces·here··¶
Trailing·spaces···↵↩
¶
Windows·line·ending
\u00b7 = space\u2192 = tab\u00b6 = LF\u21b5 = CRLF

Spaces

15

Tabs

1

LF

3

CRLF

1

Trailing

2

Lines

5

What It Does

Whitespace Visualizer makes invisible characters in text visible. Paste any text or code and see every space, tab, line ending, and non-printable character rendered as a distinct visible symbol. Essential for debugging whitespace-sensitive files, cleaning up copy-pasted content, and investigating line ending mismatches.

Character Reference

  • · — regular space (U+0020)
  • — horizontal tab (U+0009)
  • — line feed / LF (U+000A, Unix)
  • with CR marker — CRLF (U+000D U+000A, Windows)
  • ° — non-breaking space (U+00A0)
  • — trailing whitespace highlighted

Common Use Cases

  • Diagnosing Python IndentationError from mixed tabs and spaces
  • Spotting CRLF line endings in shell scripts that break on Linux
  • Finding non-breaking spaces copied from PDFs or Word documents
  • Auditing trailing whitespace before committing to version control
  • Verifying that CSV files have clean, consistent delimiters

Fixing Whitespace Issues

To strip CRLF on Unix: sed -i 's/\r//' file.txt. To remove trailing whitespace: sed -i 's/[[:space:]]*$//' file.txt. In VS Code, enable "Trim Trailing Whitespace" in settings and set "End of Line" to \n to enforce LF on save.

Frequently Asked Questions

What is the difference between LF and CRLF line endings?
LF (\n, line feed) is the Unix/Linux/macOS standard. CRLF (\r\n, carriage return + line feed) is the Windows standard. Mixed line endings in a single file can cause issues with version control diffs, shell scripts, and certain parsers.
Why does trailing whitespace matter in code?
Trailing spaces and tabs are invisible but get captured in version control diffs, making code reviews noisy. Some languages like Python and Makefile have whitespace-sensitive syntax where unexpected trailing characters can cause errors.
How do I fix CRLF line endings on macOS or Linux?
Use the command: sed -i 's/\r//g' filename.txt to strip carriage returns. In VS Code, you can click the line ending indicator in the status bar to convert the whole file. Most editors also have a setting to enforce LF on save.
What is a non-breaking space and where does it come from?
A non-breaking space (U+00A0) looks identical to a regular space but behaves differently — text editors and parsers treat it as a non-whitespace character. It commonly appears when copying text from PDFs, web pages, or word processors.
How can I check for mixed tabs and spaces in my code?
Paste your code into the Whitespace Visualizer and look for a mix of tab markers and dot markers on the same indentation lines. Mixing tabs and spaces is a common source of IndentationError in Python.