# Non-Breaking Space (U+00A0)

Copy the non-breaking space (&nbsp;, U+00A0). How it differs from a normal space, why it breaks code and searches, and how to find and remove it.

| Property | Value |
| --- | --- |
| Codepoint | `U+00A0` |
| Decimal | `160` |
| HTML entity | `&nbsp;` |
| CSS escape | `\00A0` |
| JavaScript escape | `\u00A0` |
| URL encoding | `%C2%A0` |
| UTF-8 hex | `C2 A0` |
| Unicode category | Space Separator (Zs) |
| Unicode block | Latin-1 Supplement |

The non-breaking space (NBSP, U+00A0) is the best-known invisible character on the web. Developers type it as `&nbsp;`; writers paste it from Word without knowing. It looks exactly like a regular space, but it stops the line from breaking there, so the words on either side stay together.

That makes it useful for typography. It also causes a classic bug: two strings that look identical fail to match because one has non-breaking spaces where the other has regular ones.

## Common Uses

- **Keeping words together.** Numbers and units (100 km), titles and names (Dr. Smith), and page references (page 7) should not split across lines.
- **Extra whitespace in HTML.** Browsers collapse multiple regular spaces into one but keep non-breaking spaces, which made `&nbsp;` the classic way to add spacing.
- **Blank usernames.** Some platforms accept NBSP in a username, which makes the profile name look blank.
- **French typography.** French rules call for a non-breaking space before semicolons, colons, question marks, exclamation marks and some quotation marks, so the punctuation never starts a line.
- **Empty table cells.** In HTML, empty table cells may collapse to zero height. `&nbsp;` keeps them at their proper height.

## How to Type

| Platform | Method |
|----------|--------|
| Windows | Alt+0160 on the numeric keypad. |
| macOS | Option+Space (this is the most common way Mac users accidentally insert NBSP). |
| Linux | Ctrl+Shift+U, type `00A0`, press Enter. |
| Mobile | No standard keyboard input. Copy from this page. |
| HTML | Type `&nbsp;` or `&#160;` or `&#x00A0;`. |
| JavaScript | Use `\u00A0` in strings. |
| CSS | Use `content: '\00A0';` in pseudo-elements. |
| LaTeX | Use `~` (tilde) for a non-breaking space. |

### The macOS Trap

Hold Option for a special character, hit Space before letting go, and you get NBSP instead of a space. The code looks right but fails. Many invisible bugs in code written on a Mac start here.

## Why NBSP Causes Bugs

Non-breaking space (U+00A0) and regular space (U+0020) are different Unicode characters that look identical. So:

- **String comparison fails.** `"hello world" === "hello\u00A0world"` is `false`, though both show "hello world" on screen.
- **Search and find/replace miss it.** Searching for a space will not find non-breaking spaces.
- **JSON parsing can break.** NBSP in a JSON key, or where regular whitespace is expected, can make parsers throw errors.
- **CSS selectors can fail.** A class attribute with NBSP instead of a regular space becomes one class name instead of two.
- **Regular expressions differ.** `\s` matches NBSP in some regex flavors but not others.
- **Trimming may not work.** Some languages' `trim()` strips regular spaces but leaves NBSP.

### How to Detect NBSP in Code

In JavaScript:
```js
// Check if a string contains NBSP
text.includes('\u00A0')

// Replace all NBSP with regular spaces
text.replace(/\u00A0/g, ' ')

// Or use the broader approach - replace all Unicode spaces
text.replace(/[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g, ' ')
```

## Where NBSP Sneaks Into Your Text

NBSP rarely gets into text on purpose. The usual sources:

1. **Microsoft Word.** Word can insert NBSP automatically, for example before colons, question marks and other punctuation in French text.
2. **Google Docs.** Text copied out of Google Docs can contain NBSP, especially around formatted or consecutive spaces.
3. **Web pages.** HTML that uses `&nbsp;` for spacing pastes as real NBSP characters.
4. **macOS Option+Space.** The most common accidental source for developers.
5. **AI chatbots.** Text copied from ChatGPT and other AI tools can contain NBSP and its narrow cousin U+202F (see below).
6. **CMS rich text editors.** WordPress, Contentful and other CMS editors often insert NBSP when you type consecutive spaces or leave empty paragraphs.
7. **PDF text extraction.** Text copied from PDFs often has NBSP instead of regular spaces.

## The "ChatGPT Watermark": Hidden Spaces in AI Text

In April 2025, the AI-detection startup Rumi reported that ChatGPT's newer models (o3 and o4-mini at the time) were inserting **narrow no-break spaces (U+202F)**, mostly into longer outputs. The finding spread as a "ChatGPT watermark" for catching AI-written essays.

OpenAI told Rumi the characters were not a deliberate watermark but "a quirk of large-scale reinforcement learning." NNBSP is also legitimate typography, for example in French, so its presence alone proves nothing. Either way, these spaces **break string matching, validation and diffs** just like a regular NBSP. Before you paste AI output into code, spreadsheets or CMS fields, run it through the [Invisible Character Viewer](/): it shows every U+00A0 and U+202F and strips them in one click.

## NBSP vs Other Space Characters

| Character | Width | Prevents line break? | Common name |
|-----------|-------|---------------------|-------------|
| Space (U+0020) | Normal | No | Regular space |
| Non-Breaking Space (U+00A0) | Normal | Yes | NBSP, &nbsp; |
| Narrow No-Break Space (U+202F) | Narrow | Yes | NNBSP |
| En Space (U+2002) | Half em | No | En space |
| [Em Space](/characters/em-space) (U+2003) | Full em | No | Em space |
| Thin Space (U+2009) | Thin (~1/5 em) | No | Thin space |
| Hair Space (U+200A) | Very thin | No | Hair space |
| Zero-Width Space (U+200B) | Zero | No (allows break) | ZWSP |

Mixing these up causes different bugs. See the [Zero-Width Space](/characters/zero-width-space) (zero width, allows line breaks, the opposite of NBSP), the [Word Joiner](/characters/word-joiner) (U+2060, prevents line breaks like NBSP but with no width) and the [Em Space](/characters/em-space) (the width of the letter M). Narrow No-Break Space (U+202F) is the thinner NBSP used in French typography and the character behind the "ChatGPT watermark" story.

## For Web Developers

Before you reach for `&nbsp;`, check whether CSS does the job better:

- **Layout spacing:** use CSS `margin` or `padding`.
- **Keeping words together:** `&nbsp;` works, or put CSS `white-space: nowrap` on a wrapping element.
- **Empty table cells:** use CSS `empty-cells: show`.

Using `&nbsp;` for visual layout is a code smell. Reserve it for keeping words together.

## Frequently Asked Questions

### What is the difference between a regular space and a non-breaking space?

A regular space (U+0020) lets the browser or app break the line at that point. A non-breaking space (U+00A0) looks the same but blocks the line break, so the words on either side stay together on one line.

### What does &nbsp; mean in HTML?

&nbsp; is the HTML entity for the non-breaking space (U+00A0). It is often used to add extra whitespace, because browsers collapse multiple regular spaces into one but keep non-breaking spaces.

### Why are there non-breaking spaces in my copied text?

Word processors like Microsoft Word and Google Docs can insert non-breaking spaces while formatting, and they come along invisibly when you copy and paste. Paste your text into our Invisible Character Viewer to find and remove them.

### How do I type a non-breaking space on Mac?

Press Option+Space on macOS to type a non-breaking space. This works in most applications including text editors, browsers, and word processors.

### Can non-breaking space cause bugs in code?

Yes. A non-breaking space looks like a regular space but is a different character (U+00A0 vs U+0020). It silently breaks string comparison, search, JSON parsing, CSS selectors and variable names, making it one of the most common invisible bugs in web development.

### Does ChatGPT put hidden spaces in its text?

Sometimes. In April 2025, the AI-detection startup Rumi reported that OpenAI's o3 and o4-mini models were inserting narrow no-break spaces (U+202F), a thinner cousin of the non-breaking space, mostly into longer outputs. OpenAI said it was not a watermark but a quirk of large-scale reinforcement learning. Paste your text into our Invisible Character Viewer to find and strip them.

## Related Characters

- [Zero-Width Space (U+200B)](https://invisiblecharacterviewer.com/characters/zero-width-space)
- [Word Joiner (U+2060)](https://invisiblecharacterviewer.com/characters/word-joiner)
- [Soft Hyphen (U+00AD)](https://invisiblecharacterviewer.com/characters/soft-hyphen)
- [Hangul Filler (U+3164)](https://invisiblecharacterviewer.com/characters/hangul-filler)
- [Braille Pattern Blank (U+2800)](https://invisiblecharacterviewer.com/characters/braille-pattern-blank)
- [Em Space (U+2003)](https://invisiblecharacterviewer.com/characters/em-space)

---

Canonical URL: https://invisiblecharacterviewer.com/characters/non-breaking-space
Markdown URL: https://invisiblecharacterviewer.com/characters/non-breaking-space.md
Agent instructions: https://invisiblecharacterviewer.com/llms.txt
