Sign up

What Is NBSP? Non-Breaking Space Meaning, Code Examples and Copy-Paste Table (2026)

What Is NBSP? Non-Breaking Space Meaning, Code Examples and Copy-Paste Table (2026)

Last updated: October 2026. Every NBSP code example was tested in Chrome 141, Node.js 22, Python 3.13 and PHP 8.3.

  (NBSP) is the HTML code for a non-breaking space: a space that looks like a normal space but stops the browser from breaking the line at that point. It’s also the reason you sometimes see “ ” printed as text in an email or web page.

This guide gives you the copy-paste character and its code for HTML, CSS, JavaScript, React, Python, PHP, Excel and your keyboard. It also covers the bugs it causes and how to fix them. We tested every code example below, and noted where languages behave differently.

Quick Answer: NBSP ( ) means non-breaking space, the Unicode character U+00A0. It looks like a normal space, but the browser never breaks a line at it and never collapses several of them into one. Write it as   or   in HTML, \u00A0 in JavaScript, \xa0 in Python and \00a0 in CSS. On a keyboard, press Option + Space on a Mac or Alt + 0160 on Windows.

What does NBSP ( ) mean?

NBSP, written   in HTML, stands for “non-breaking space.” It’s an HTML character entity that inserts the Unicode character U+00A0 (NO-BREAK SPACE). Two things make it different from the space bar:

  • It never breaks. The words on either side of it always stay on the same line.
  • It never collapses. Browsers squash several normal spaces into one, but they keep every   you write.

So 10 km always shows “10 km” on one line, and A   B really shows three spaces.

You can write the same character four ways in HTML (all listed in the HTML standard’s named character references). All four produce exactly the same U+00A0 character:

&nbsp;               <!-- named entity (most common) -->
&#160;               <!-- decimal code -->
&#xA0;               <!-- hexadecimal code -->
&NonBreakingSpace;   <!-- long HTML5 name -->

Copy and paste NBSP and other space characters

Click Copy to put the real character on your clipboard, ready to paste into a CMS, a design tool, a spreadsheet or a subject line. The table also covers the other Unicode spaces people often mix up with &nbsp;.

CharacterUnicodeHTML entityNumeric codeCSSJavaScriptLine break?Use forCopy
Non-breaking spaceU+00A0&nbsp;&#160;\00a0\u00A0NoKeeps words on one line
Regular spaceU+0020—&#32;\0020' 'YesThe normal space bar
Narrow no-break spaceU+202F—&#8239;\202f\u202FNoFrench numbers, units
Figure spaceU+2007&numsp;&#8199;\2007\u2007NoWidth of one digit
En spaceU+2002&ensp;&#8194;\2002\u2002YesHalf an em wide
Em spaceU+2003&emsp;&#8195;\2003\u2003YesAs wide as the font size
Thin spaceU+2009&thinsp;&#8201;\2009\u2009YesAbout 1/5 em
Hair spaceU+200A&hairsp;&#8202;\200a\u200AYesThinnest visible space
Zero-width spaceU+200B&ZeroWidthSpace;&#8203;\200b\u200BYesInvisible, allows a break
Word joinerU+2060&NoBreak;&#8288;\2060\u2060NoInvisible, blocks a break

“Line break?” means whether the browser may wrap the line at that character. Copy buttons copy the real Unicode character, not the HTML code.

A few notes on the table:

  • Narrow no-break space (U+202F) has no named HTML entity, so use &#8239;. French number formatting uses it: in our test, JavaScript’s Intl.NumberFormat('fr-FR') wrote 1 234 567 with U+202F, not U+00A0.
  • Zero-width space is invisible. It allows a line break where there isn’t one, which is the opposite of &nbsp;.
  • Word joiner (U+2060) is the invisible version of &nbsp;. It blocks a break without adding any space.

NBSP vs regular space

We measured both in Chrome 141 to show the difference, rather than describe it:

TestRegular space&nbsp;
“Hello World” in a 60px-wide boxWrapped onto 2 lines (38px tall)Stayed on 1 line (19px tall)
Three spaces between A and BCollapsed to one space (25px wide)Kept all three (34px wide)
Unicode code pointU+0020U+00A0
Bytes in UTF-812 (C2 A0)
Counted as whitespace by JavaScript \s and trim()YesYes
Removed by PHP trim()YesNo

When to use NBSP (and when not to)

Use NBSP to keep short, meaningful units together:

  • Numbers and units: 10&nbsp;km, 25&nbsp;%, $&nbsp;49
  • Dates and times: October&nbsp;8, 9:30&nbsp;AM
  • Names and titles: Dr.&nbsp;Patel, Windows&nbsp;11
  • Phone numbers: +1&nbsp;555&nbsp;0100
  • The last two words of a headline, so one word never sits alone on the final line

Don’t use &nbsp; for layout. Chains like &nbsp;&nbsp;&nbsp;&nbsp; to push text sideways break on mobile screens and are hard to maintain. Use CSS instead:

/* Indent or add space with padding or margin */
.price { margin-left: 8px; }

/* Keep a whole phrase on one line without entities */
.no-wrap { white-space: nowrap; }

How to type or insert NBSP (code for every language)

HTML and Markdown

<p>The meeting starts at 9:30&nbsp;AM.</p>

Most Markdown renderers, including GitHub’s, accept &nbsp; as written.

CSS

Inside a CSS content value, use the escape \00a0:

.label::after {
  content: "\00a0→";   /* a non-breaking space, then an arrow */
}

JavaScript

In JavaScript strings, write \u00A0. Assigning &nbsp; to textContent won’t work, because you’d get the literal text ” “.

const label = 'Price:\u00A0$49';
el.textContent = label;            // shows "Price: $49" on one line

// Convert normal spaces to non-breaking ones
const unbreakable = 'Windows 11'.replace(/ /g, '\u00A0');

// Clean them out again (\s matches U+00A0 in JavaScript)
const clean = input.replace(/\u00A0/g, ' ');

React (JSX)

JSX accepts the entity directly in text. Inside a string or expression, use the escape:

<p>Total:&nbsp;$49</p>
<p>{'Total:\u00A0$49'}</p>

Python

text = "Price:\xa0$49"

text.replace("\xa0", " ")   # 'Price: $49'

import unicodedata
unicodedata.normalize("NFKC", text)   # also turns \xa0 into a normal space

Python’s strip(), split() and isspace() all treat \xa0 as whitespace.

PHP

PHP is the one that catches people out: trim() does not remove non-breaking spaces by default. In our PHP 8.3 test, trim("\u{00A0}hi\u{00A0}") returned the string unchanged.

$text = html_entity_decode('Price:&nbsp;$49');   // contains "\xC2\xA0", not a space

// Replace U+00A0 with a normal space
$clean = str_replace("\u{00A0}", ' ', $text);

// Or trim it explicitly
$clean = trim($text, " \u{00A0}");

Excel and Google Sheets

Data pasted from web pages often hides CHAR(160) non-breaking spaces, which break VLOOKUP and TRIM. To replace them:

=SUBSTITUTE(A1, CHAR(160), " ")
=TRIM(SUBSTITUTE(A1, CHAR(160), " "))

In Excel for Mac, use UNICHAR(160) instead of CHAR(160). It also works in Windows Excel and Google Sheets.

NBSP keyboard shortcuts

WhereShortcut
Windows (any app)Alt + 0160 on the numeric keypad
macOS (any app)Option + Space
Microsoft Word (Windows)Ctrl + Shift + Space
Microsoft Word (Mac)Option + Space
Google DocsInsert → Special characters → search “no-break space”

Why does NBSP (&nbsp;) show up as text?

If readers see the literal letters “&nbsp;” on a page or in an email, the entity was encoded twice. Somewhere along the way, &nbsp; became &amp;nbsp;. The browser decodes it once and prints ” ” as text.

Common causes:

  • A CMS, form or API escaped HTML that was already escaped
  • Text copied from a code view and pasted into a visual editor
  • An email’s plain-text version built from HTML without decoding entities

How to fix it: find the step that encodes twice and remove it. To clean existing content, search for &amp;nbsp; and replace it with &nbsp;. In the plain-text part of an email, replace it with a normal space.

Why do I see “” before spaces?

A stray “” is the same character with a different bug. A non-breaking space is stored as two bytes in UTF-8 (C2 A0). When software reads those bytes as Latin-1 or Windows-1252 instead of UTF-8, the first byte shows up as “”. We reproduced it in Python: "a\xa0b" decoded the wrong way became "a b".

The fix: declare UTF-8 everywhere. That means <meta charset="utf-8"> in HTML, Content-Type: text/html; charset=UTF-8 in emails, and UTF-8 settings in your database connection and export files.

Always include the semicolon

Browsers accept &nbsp without a semicolon in normal text. Inside attributes, it doesn’t work: in our Chrome test, the link ?x=1&nbsp=2 kept &nbsp as literal text, while the same entity in a paragraph turned into a space. Writing &nbsp; every time avoids both problems.

NBSP in HTML emails

Email adds a few rules on top of normal web pages. (For layout basics, see our email design best practices.)

  • It’s safe everywhere. Gmail, Outlook, Apple Mail and Yahoo all render &nbsp; correctly, so you can use it for prices, dates and names in email copy.
  • It adds weight. Each &nbsp; is 6 bytes. Gmail clips messages over 102KB behind a “[Message clipped]” link, which also hides your footer and unsubscribe link. Hundreds of entities used for spacing add up, so use table padding instead.
  • Check the plain-text version. If your HTML is converted to plain text automatically, look for leftover “&nbsp;” in it before you send.
  • It’s part of the preview-text trick. Inbox apps show the first text in an email as the preview. To stop body text from leaking into it, email developers add a hidden block of &zwnj;&nbsp; pairs right after the preheader:
<div style="display:none; max-height:0; overflow:hidden;">
  Your 20% discount ends tonight
  &zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;&zwnj;&nbsp;
</div>

Use as many pairs as you need to fill the preview line. Around 50 to 100 is common.

Sending the same template from Outlook? Here’s how to convert HTML to an Outlook template (OFT). And if a message never arrives at all, the bounce notice explains why: see what a mailer-daemon bounce means and how to fix it.

If you code templates yourself, Mailercloud’s custom HTML editor lets you paste your own code and preview it before sending. Mailercloud’s library of third-party integrations is smaller than Mailchimp’s or HubSpot’s, so check that your tools connect before you switch.

Summary

NBSP (&nbsp;) is HTML’s non-breaking space (U+00A0). It keeps two words on the same line and is never collapsed. Use it for units, dates, names and short phrases, and use CSS for layout. In code, write \u00A0 in JavaScript, \xa0 in Python and \u{00A0} in PHP, and remember that PHP’s trim() won’t remove it. If “&nbsp;” or “” appears on screen, look for double encoding or a missing UTF-8 setting.

FAQ: Non-Breaking Space (&nbsp;)

What does &nbsp; mean?

&nbsp; means “non-breaking space.” Mailercloud’s guide explains that it’s an HTML entity for the Unicode character U+00A0, which looks like a normal space but keeps the words on either side on the same line. Browsers also never collapse it, so several &nbsp; in a row show as several spaces.

How do I type a non-breaking space?

Mailercloud’s guide lists the quickest ways: press Alt + 0160 on Windows or Option + Space on a Mac. In Microsoft Word on Windows, press Ctrl + Shift + Space. In HTML, type &nbsp; or &#160;. You can also copy the character from the table in this guide.

What is the difference between &nbsp; and a regular space?

A regular space (U+0020) lets text wrap and collapses when repeated. In Mailercloud’s Chrome test, “Hello World” wrapped in a narrow box with a regular space but stayed on one line with &nbsp;. Three &nbsp; also stayed three spaces wide, while three regular spaces collapsed into one.

Why does &nbsp; appear as text on my page or email?

Mailercloud’s guide traces this to HTML that was encoded twice, turning &nbsp; into &amp;nbsp;. Find the step that escapes your HTML a second time and remove it, or replace &amp;nbsp; with &nbsp; in the stored content.

Is &nbsp; outdated?

No. Mailercloud’s guide explains that &nbsp; is part of the current HTML standard and works in every modern browser and major email client. It’s only outdated as a layout tool. For spacing and indents, use CSS margin, padding or white-space: nowrap instead.

Why does “” appear before spaces?

Mailercloud traced this to a character-encoding mismatch. A non-breaking space is two bytes in UTF-8 (C2 A0), and software that reads it as Latin-1 shows the first byte as “”. Declare UTF-8 in your HTML, email headers and database to fix it.

Amar

Amar

Amar CP is the Co-Founder and Sales Director at Mailercloud, where he leads partnerships, alliances, and customer growth. With over a decade of experience in application development, database architecture, and scaling web systems, Amar brings a rare blend of engineering depth and go-to-market expertise to email marketing. He writes about email deliverability, marketing automation, and helping small businesses grow smarter with data-driven campaigns.

Related Articles