Home / Guides / Non-breaking spaces: why pasted text won't wrap or search properly
Non-breaking spaces: why pasted text won't wrap or search properly
A non-breaking space looks exactly like a normal space but tells software never to break the line at that point, and it can also make find-and-replace and word counts behave oddly. It usually arrives in pasted text from Word, Google Docs or a web page, where it's used deliberately to stop things like "10 km" wrapping across two lines. Paste & Wash replaces non-breaking and other unusual spaces with a normal one.
Sometimes pasted text looks completely normal but a search that should obviously match comes up empty, or a line refuses to wrap where you'd expect. One of the most common invisible causes is a non-breaking space standing in for what looks like an ordinary gap between two words.
What a non-breaking space is
A normal space lets a line of text wrap onto the next line at that point. A non-breaking space (Unicode character U+00A0) looks identical on screen but explicitly tells software not to break the line there, so the words on either side of it always stay together.
It exists for good reasons: to keep "10 km", "Mr. Smith" or a figure and its unit from splitting awkwardly across two lines. Writers, word processors and web pages use it for exactly these situations.
How it ends up in your pasted text
- Copying from Microsoft Word or Google Docs, where it appears when a writer types one on purpose (Ctrl+Shift+Space in Word) or when language settings call for it, as in French.
- Copying from a web page, where designers use it to control layout and spacing.
- Copying a table or a price list, where it is sometimes used to keep numbers and units together.
- Copying from anything that was itself built from web pages, since HTML has a dedicated code, , for this character.
The problems it causes
- A search or find-and-replace fails because the space you typed doesn't match the non-breaking space in the text.
- A line of text refuses to wrap where it should, leaving an oddly long line or unexpected extra white space.
- Some code, configuration files and command-line tools treat it as a completely different character than a normal space, which can cause a script or a lookup to fail silently.
- Word counts and character counts can come out slightly different from what you'd expect.
How to fix it
- Open Paste & Wash and paste in the text.
- Leave Odd and repeated spaces on in the options; it's on by default.
- Every non-breaking space, along with other look-alike spacing characters, is replaced with a normal one.
- The report under the tool shows exactly how many were found and replaced.
When non-breaking spaces are useful
A non-breaking space is not a mistake. It keeps two words on the same line, which is helpful in a unit such as 10 km, a title such as Mr Smith, or a date such as 5 May. French typography also uses a non-breaking space before marks such as the question mark and the colon.
If you write in French, or you set type carefully, you may want to keep them. Untick Odd and repeated spaces to leave them in place.
How to type one on purpose
- Word on Windows: Ctrl+Shift+Space.
- Mac: Option+Space.
- HTML: the entity.
Other look-alike spaces
The non-breaking space is the most common, but there are others, such as the thin space (U+2009), the narrow no-break space (U+202F), the en and em spaces (U+2002 and U+2003) and the ideographic space (U+3000). They all look like a gap and behave differently in searches and formulas.
One more place they bite is Excel, where the TRIM function removes ordinary spaces but not character 160. Replacing character 160 with a normal space first, using SUBSTITUTE with UNICHAR(160), fixes cells that look empty or fail to match.
How to tell if you have one
A non-breaking space looks like an ordinary space, so you need a tool to spot it. In Word, turn on formatting marks with Ctrl+Shift+8 and look for a small raised circle where a space should be. In Excel, the formula UNICODE applied to a character returns 160 for a non-breaking space and 32 for a normal one, so you can test a suspicious cell.
In a browser, copying a sentence into a code editor that shows invisible characters will highlight it. The quickest check for pasted text is a cleaner that counts them: the report in Paste & Wash tells you how many odd spaces it found and replaced.
Try the cleaner to see what is hiding in your own text.