HTML Non-Breaking Space

Beginner
10 min read
Updated: Nov 2026
5 examples
 

Definition and Usage

A non-breaking space is a space that looks like a normal space but prevents a line break at that position. In HTML you usually write it as   (named entity for Unicode U+00A0, NO-BREAK SPACE).

Why does it matter on an HTML page?

Narrow columns and mobile screens wrap text wherever a normal space allows. Without glue, you can get awkward splits like Mr. on one line and Smith on the next, or 10 alone and kg below it.

How is it different from a regular space?

A regular space (U+0020) may collapse (several spaces become one) and allows wrapping. A non-breaking space does not collapse like ordinary HTML whitespace and blocks wrapping at that spot.

When should you use it?

Only where wrapping would hurt meaning or readability—not for indenting or pushing layout. Prefer CSS for spacing and alignment.

Think “glue.”

Mr. Smith and 10 kg keep related tokens on one line.

Not a layout tool.

Do not chain     to indent. Use CSS margin, padding, or gap.

Tutorial vs entity page.

This page teaches usage in HTML documents. For every encoding of U+00A0, see HTML Entity: Non-Breaking Space.

HTML Syntax

Write a non-breaking space with a character reference inside your markup:

HTML
<p>Mr.&nbsp;Smith</p>
<p>Weight: 10&nbsp;kg</p>
<p>Phone: 123&nbsp;456&nbsp;7890</p>
HTML
<!-- All three insert U+00A0 -->
<p>Hello&nbsp;World</p>
<p>Hello&#160;World</p>
<p>Hello&#xA0;World</p>

Core HTML Concepts

What to remember while writing pages:

ConceptDetail
Named entity&nbsp; (also &NonBreakingSpace;)
Decimal / hex&#160; / &#xA0;
UnicodeU+00A0 — NO-BREAK SPACE
Looks likeA normal space on screen
Wrap behaviorNo line break at this space
CollapseDoes not collapse like ordinary HTML spaces

Regular space vs non-breaking space

Regular space&nbsp;
Code pointU+0020U+00A0
Line wrapAllowedBlocked here
In HTML sourcePress SpaceWrite &nbsp; (or numeric)
Best forNormal word spacingGluing related tokens

Common places on a page

Use caseExample
Title + nameMr.&nbsp;Smith
Number + unit10&nbsp;kg
Phone groups123&nbsp;456&nbsp;7890
Date partsJan&nbsp;5,&nbsp;2026
Price + currency$19&nbsp;USD

How to Use Non-Breaking Spaces in HTML

A simple workflow:

  1. Write your text with normal spaces first.
  2. Preview in a narrow column or DevTools device mode.
  3. Where a wrap looks wrong, replace that space with &nbsp;.
  4. Keep real words intact—glue tokens, do not split letters.
  5. Use CSS for indentation and gaps, not repeated &nbsp;.
GoalDo this
Keep two words togetherword1&nbsp;word2
Same character, other spellings&#160; or &#xA0;
Indent a blockCSS margin / padding
Space between flex itemsCSS gap

Live Preview

Drag the handle to narrow the box. The regular space can wrap; the &nbsp; version stays glued.

160px

Regular space

Mr. Smith weighed 10 kg today.

With &nbsp;

Mr. Smith weighed 10 kg today.

Narrow the column until “Mr.” / “10” wrap in the first box but stay attached in the second.

HTML Examples

Five patterns from a title to a full page. Try It demos use plain HTML so you can focus on &nbsp;.

Example 1 — Title and Surname

HTML
<p>Mr.&nbsp;Smith</p>
<p>Dr.&nbsp;Jane&nbsp;Doe</p>
Try It Yourself

How It Works

  1. Honorific + name often wrap after the period with a normal space.
  2. &nbsp; glues “Mr.” to “Smith”.
  3. Resize the Try It preview to see the effect.
  4. Same idea works for Dr., Ms., Prof., and similar titles.

Example 2 — Phone Number

HTML
<p>Phone: 123&nbsp;456&nbsp;7890</p>
Try It Yourself

How It Works

  1. Digit groups stay readable as a phone number.
  2. Breaks can still happen between groups in a very narrow box.
  3. Looks like ordinary spaces when rendered.
  4. Also works for postal codes and short IDs.

Example 3 — Number and Unit

HTML
<p>Weight: 10&nbsp;kg</p>
<p>Temperature: 25&nbsp;&deg;C</p>
Try It Yourself

How It Works

  1. Value + unit belong together visually.
  2. &nbsp; stops a lonely number on its own line.
  3. &deg; is a separate entity for the degree sign.
  4. Same pattern for %, px, MB, and currency codes.

Example 4 — Three Entity Forms (Same Result)

HTML
<p>Named: Hello&nbsp;World</p>
<p>Decimal: Hello&#160;World</p>
<p>Hex: Hello&#xA0;World</p>
Try It Yourself

How It Works

  1. All three decode to U+00A0.
  2. Beginners usually start with &nbsp;.
  3. Numeric forms are handy in generated HTML.
  4. Full encoding table lives on the entity page.

Example 5 — Full Page

Phone spacing plus a notice that should not wrap awkwardly:

HTML
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Non-Breaking Space Example</title>
</head>
<body>
  <h1>Contact</h1>
  <p>Phone: 123&nbsp;456&nbsp;7890</p>
  <p>Price: $19&nbsp;USD</p>
  <p>Important:&nbsp;Do&nbsp;not&nbsp;share&nbsp;this&nbsp;code.</p>
</body>
</html>
Try It Yourself

How It Works

  1. One document can mix several glue points.
  2. Phone and price stay readable when the column shrinks.
  3. Short notices can use   sparingly—do not over-glue long sentences.
  4. Try It lets you narrow the preview and compare.

Edge Cases & Pitfalls

Most problems come from overuse or using   as fake CSS.

overuse

Gluing everything

Too many non-breaking spaces cause overflow and horizontal scroll on small screens.

layout

Indenting with    

Fragile and hard to maintain. Use CSS spacing instead.

a11y

Splitting real words

Do not insert spaces between letters of a word. Keep language intact for screen readers.

css

Expecting wrap: anywhere to ignore it

Some CSS can still force breaks. Preview your real layout on narrow viewports.

hyphen

Need a non-breaking hyphen?

That is a different character (U+2011). See the non-breaking hyphen entity.

source

Invisible literal U+00A0 in editors

Pasted no-break spaces can confuse diffs. Prefer visible &nbsp; in source.

Browser Support

Non-breaking spaces and the   entity are supported in every modern and legacy browser. Always preview narrow layouts after adding glue.

✓ Baseline · Universally available

  in HTML

Named and numeric references for U+00A0 work everywhere HTML is rendered.

100% &nbsp; support
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
Non-breaking space Universal

Bottom line: Use   for meaning and readability—not layout. Pair with CSS for spacing.

Key Takeaways

  • &nbsp; inserts a space that will not wrap.
  • Glue titles, units, phones, and short labels—not whole paragraphs.
  • &nbsp;, &#160;, and &#xA0; are the same character.
  • CSS handles layout spacing; &nbsp; handles wrap control.

One line: Replace a normal space with &nbsp; only where a line break would look wrong.

Frequently Asked Questions

&nbsp; is the named character reference for a non-breaking space (Unicode U+00A0). The browser shows a normal-looking space that will not allow a line break at that position.
Use it to keep related tokens together: titles with names (Mr. Smith), numbers with units (10 kg), phone digit groups, dates, or short labels that look wrong when wrapped.
A regular space (U+0020) can collapse in HTML and allows wrapping. A non-breaking space (U+00A0) does not collapse like ordinary whitespace and prevents wrapping at that spot.
Yes. All three insert U+00A0. Prefer &nbsp; in tutorials and everyday markup; use numeric forms when you need them.
No. Do not chain &nbsp; characters to indent or push content. Use CSS margin, padding, gap, or flex/grid instead.
This tutorial focuses on when and how to use non-breaking spaces in HTML pages. The entity page lists encodings (named, hex, decimal, CSS) for U+00A0 in detail.

Practice in the editor

Open a Try It demo and narrow the preview to see   prevent awkward wraps.

Open Try It editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful