HTML Entity for Superscript Two (²)

Beginner
6 min read
Updated: Sep 2026
1 example
Unicode U+00B2

What Is the Superscript Two Entity?

Superscript Two (²) is the Unicode character at U+00B2 in the Latin-1 Supplement block. It looks like a small raised 2 and is common for squares such as x², m², and exponents.

Remember
Character     ²
Unicode       U+00B2
Hex entity    ²
Decimal       ²
Named entity  ²
CSS escape    \00B2

All of these produce the same glyph: ². Prefer &sup2; when you want readable markup; use <sup>2</sup> when you want semantic superscript formatting instead.

Quick Reference

One table for every form you will actually use.

FormCodeWhere it goes
Direct character²HTML text (UTF-8)
Named entity&sup2;HTML markup (preferred readable form)
Hex entity&#x00B2;HTML markup
Decimal entity&#178;HTML markup
CSS escape\00B2Stylesheet content
Semantic tag<sup>2</sup>HTML (formatting, not the ² glyph)

When to use which

SituationUse
Need the Unicode glyph ²&sup2;, or &#x00B2; / &#178;
Generated text via ::before / ::aftercontent: "\00B2"
Semantic superscript for any text<sup>2</sup>
Plain digit two (not superscript)Type 2 (U+0032)
Readable HTML sourcePrefer &sup2;

Live Preview

Superscript Two rendered in common writing contexts.

Inline text Area = 12 m²
Large glyph ²
In a power x² = x × x   5² = 25
Monospace n² → square
With entities Named: ² | Hex: ² | Decimal: ²
Semantic <sup> x2 (tag styles digit 2)

Complete HTML Example

One page that shows Superscript Two with hex, decimal, named entity, CSS escape, and the semantic <sup> option. Use View Output or open the live editor.

Hex + Decimal + Named + CSS + <sup>

Five ways to show a raised two in a single document.

html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Superscript Two (²) in HTML</title>
  <style>
    #point::after {
      content: "\00B2";
    }
  </style>
</head>
<body>
  <p>Superscript Two using Hex Code: &#x00B2;</p>
  <p>Superscript Two using HTML Code: &#178;</p>
  <p>Superscript Two using Named Entity: &sup2;</p>
  <p id="point">Superscript Two using CSS Entity: </p>
  <p>Semantic alternative: x<sup>2</sup></p>
</body>
</html>
Try It Yourself

How It Works

1. Hex: U+00B2 → &#x00B2; in HTML. The browser turns it into ².

2. Decimal: same code point as 178 → &#178;. Same result as hex.

3. Named: &sup2; is the standard HTML named entity for ² — easier to read in source.

4. CSS: use \00B2 in content (not an HTML entity). #point::after appends that ² after the paragraph text.

5. Semantic <sup>: x<sup>2</sup> styles digit two as a superscript. Prefer this when you need meaning, not a specific Unicode glyph.

Pitfalls & Tips

Common mistakes when working with Superscript Two entities.

Named

Use &sup2;

HTML5 defines &sup2; for ². Prefer it for readable source; numeric forms still work.

CSS vs HTML

Do not mix escapes

\00B2 belongs in CSS. &sup2; / &#x00B2; / &#178; belong in HTML.

² vs 2 vs ₂

Different characters

² is U+00B2; digit 2 is U+0032; subscript ₂ is U+2082.

Glyph vs tag

Choose intentionally

Use the Unicode glyph for exact look (great for m²); use <sup> for semantic superscript on any text.

Semicolon

End references

Always finish with ; — write &sup2; and &#178;, not without the semicolon.

Units

Squared units

For area units, m&sup2; (m²) is clearer than styling a plain 2 with CSS alone.

Browser Support

Superscript Two (U+00B2) and its entity forms (&sup2;, &#x00B2;, &#178;, CSS \\00B2) are supported in all mainstream browsers. Glyph shape depends on the font.

✓ Universal support

Superscript Two (²)

Use &sup2;, hex, decimal, or CSS escape — or use <sup> for semantic formatting.

100% Browser coverage
Google Chrome Supported
Yes
Microsoft Edge Supported
Yes
Mozilla Firefox Supported
Yes
Apple Safari Supported
Yes
Opera Supported
Yes
Internet Explorer All versions
Yes
U+00B2 / entities Full support

Bottom line: Prefer &sup2; (or &#x00B2; / &#178;) for the Unicode glyph, \\00B2 only inside CSS content, and <sup>2</sup> when you want semantic superscript.

Key Takeaways

  • Unicode: Superscript Two is U+00B2 (decimal 178).
  • HTML: prefer &sup2;, or use &#x00B2; / &#178;.
  • CSS: use \00B2 inside content for generated text.
  • Alternative: use <sup>2</sup> for semantic superscript formatting.

One line: U+00B2 → &sup2; / &#x00B2; / &#178; / CSS \00B2, or semantic <sup>2</sup>.

Frequently Asked Questions

Use &#x00B2; (hex), &#178; (decimal), &sup2; (named), or the CSS escape \00B2 in the content property. All render ². You can also paste ² directly when your file is UTF-8.
U+00B2 (hex 00B2, decimal 178). It belongs to the Latin-1 Supplement Unicode block.
Yes. HTML5 defines &sup2; for superscript two. You can also use numeric references &#x00B2; or &#178;.
Use ² (or its entities) when you need the exact Unicode superscript glyph — common for squared units like m². Use <sup>2</sup> when you want semantic superscript formatting for arbitrary text.
No. Digit two is U+0032. Subscript two is U+2082 (₂). Superscript Two is U+00B2 (²) — a different character.
HTML entities (&#178;, &#x00B2;, or &sup2;) go in markup. The CSS escape \00B2 is used in stylesheets (usually in the content property of ::before/::after). Both render ².

Did you know?

Superscript two is Unicode U+00B2 (decimal 178) in the Latin-1 Supplement block. Unlike most superscript digits, HTML5 defines a named entity: &sup2;. It is a different character from digit two (U+0032) and from subscript two ₂ (U+2082).

Next: Digit Three (3)

Continue the entity series with the HTML reference for digit three — a different character from superscript two.

Digit 3 tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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