HTML Entity for Superscript Digit Two (²)

Beginner
⏱️ 5 min read
📚 Updated: Aug 2025
🎯 1 Code Example
Unicode U+00B2

What You'll Learn

How to display the superscript digit two (²) in HTML using hex, decimal, the named entity ², and a CSS escape. It is commonly used for exponents (x²) and square units (m², km², ft²).

Superscript Two belongs to the Latin‑1 Supplement Unicode block and is referenced as Unicode U+00B2.

⚡ Quick Reference — Superscript Two (²)

Unicode U+00B2

Latin-1 Supplement block

Hex Code ²

Hexadecimal reference

HTML Code ²

Decimal reference

Named Entity ²

Readable and widely supported

Reference Table
Name           Value
────────────   ──────────
Unicode        U+00B2
Hex code       ²
HTML code      ²
Named entity   ²
CSS code       \00B2
1

Complete HTML Example

This example renders ² using the hex entity, decimal entity, the named entity, and a CSS escape on a pseudo-element:

html
<!DOCTYPE html>
<html>
<head>
 <style>
  #point:after{
   content: "\00B2";
  }
 </style>
</head>
<body>

<p>Superscript 2 using Hexa Decimal: &#x00B2;</p>
<p>Superscript 2 using HTML Code: &#178;</p>
<p>Superscript 2 using HTML Entity: &sup2;</p>
<p id="point">Superscript 2 using CSS Entity: </p>

</body>
</html>
Try It Yourself

🌐 Browser Support

Superscript Two (²), its numeric entities, and the named entity &sup2; are supported across all modern browsers:

Chrome 1+
Firefox 1+
Safari 1+
Edge 12+
Opera 4+
Android All
iOS Safari All

👀 Live Preview

See ² used in a few common contexts:

Exponent x² + y² = z²
Square units Area: 120 m² • 1.5 km² • 200 ft²
Large glyph ²
Semantic alternative x2 (using the <sup> tag)
With entities Named: ² | Hex: ² | Decimal: ²

🧠 How It Works

1

Hexadecimal Code

&#x00B2; references Unicode 00B2 in hexadecimal and renders the glyph ² in your HTML.

HTML markup
2

Decimal HTML Code

&#178; references the same Unicode code point using the decimal value 178.

HTML markup
3

Named Entity

&sup2; is the named entity for ²—easy to read and widely supported.

HTML markup
4

CSS Entity

\00B2 is a CSS escape sequence used in stylesheets (typically in content on ::before/::after).

CSS stylesheet
5

Semantic Option

If your goal is semantic superscript formatting (not a specific glyph), use <sup>2</sup> to render 2 as a superscript.

HTML semantics
=

Same visual result

All four entity methods display ². Unicode U+00B2 is part of the Latin‑1 Supplement block.

Use Cases

Superscript Two (²) is commonly used in:

📐 Exponents & Powers

Math notation such as , , and a² + b².

📏 Square Units

Area units like , km², cm², and ft².

🎓 Education

Textbooks and tutorials that need true superscript digits.

🏠 Real Estate

Property listings and floor areas such as 120 m².

🧪 Science & Engineering

Formulas, units, and technical writing where squared terms appear.

✍️ Typography

Consistent “squared” glyphs without relying on styling alone.

💡 Best Practices

Do

  • Use &sup2; when you want readable source HTML
  • Keep one style (named / hex / decimal) consistent within a page
  • Use <sup> when semantic superscript formatting matters
  • Use CSS escapes only in stylesheets (for generated content)
  • Add context like “square meters” when accessibility requires it

Don’t

  • Mix entity styles randomly across the same document
  • Use CSS escapes inside HTML markup (use them in CSS only)
  • Confuse ² (superscript) with ₂ (subscript) or the regular digit 2
  • Rely on superscripts alone to communicate meaning without words

Key Takeaways

1

² is Unicode U+00B2 (Latin‑1 Supplement)

U+00B2 &#x00B2; &#178; &sup2;
2

For CSS stylesheets, use the escape in content

\00B2
3

&sup2; is a named entity and is widely supported

4

Use <sup>2</sup> when semantic superscript formatting matters

❓ Frequently Asked Questions

Use &#x00B2; (hex), &#178; (decimal), &sup2; (named), or \00B2 in CSS content. All render ².
U+00B2 (hex 00B2, decimal 178) in Latin‑1 Supplement.
Yes. &sup2; is part of the HTML standard and works across modern browsers.
Use ² when you want the specific Unicode superscript digit glyph. Use <sup> when you want semantic superscript formatting that can apply to any text.
Yes. Use the escape \00B2 in the content property for ::before/::after to generate the symbol without extra markup.

Explore More HTML Entities!

Discover 1500+ HTML character references — currency symbols, arrows, math operators, emojis, and more.

All HTML Entities →

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