Find and Remove Non-Breaking Spaces (NBSP)
Detect non-breaking spaces (U+00A0) hidden in your text that look identical to regular spaces but cause parsing errors in code and data files.
Detailed Explanation
The Invisible Imposter: Non-Breaking Spaces
A non-breaking space (NBSP, U+00A0) looks exactly like a regular space to the human eye, but it is a completely different Unicode character. It was designed to prevent word wrapping at a specific position in typeset text, but it frequently causes problems when it appears in source code, configuration files, or data.
Where NBSPs Come From
- Copy-paste from web pages: HTML rendering often converts
entities into actual U+00A0 characters when you copy text. - Rich text editors: Word processors like Microsoft Word, Google Docs, and Apple Pages insert NBSPs for typographic purposes.
- macOS keyboard: On macOS, pressing Option+Space types a non-breaking space instead of a regular space.
- PDF extraction: Text extracted from PDFs often contains NBSPs between words.
How the Visualizer Marks Them
The tool shows each NBSP as a degree sign (°) in yellow, making it easy to distinguish from regular spaces (shown as blue middle dots ·).
Problems Caused by NBSPs
# This YAML looks valid but fails to parse:
name: John # NBSP after the colon!
# This CSS selector won't match:
.my class { } # NBSP in class name
# This JSON key comparison fails:
"user name" !== "user name"
In each case, the NBSP is invisible in most text editors but causes the parser or comparison to fail. The Whitespace Visualizer makes them immediately visible.
Removing NBSPs
In the Clean section, enable the NBSP toggle and click Clean. This replaces all non-breaking spaces with regular spaces while leaving other characters untouched.
Use Case
A web developer copies a CSS snippet from a design document and the styles don't apply. They paste the CSS into the Whitespace Visualizer and discover non-breaking spaces in class names that were invisibly inserted by the word processor. After cleaning, the CSS works correctly.