HTML Entity for Digit Two (2)

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

What Is the Digit Two Entity?

Digit two (2) is the Basic Latin character at Unicode U+0032. You can type 2 directly in HTML, or write it with a numeric character reference when you need an explicit entity form.

Remember
Character     2
Unicode       U+0032
Hex entity    2
Decimal       2
CSS escape    \0032
Named entity  (none)

All of these produce the same glyph: 2. Prefer typing 2 in normal page text; use entities for CSS content, generated markup, or when encoding must be explicit.

Quick Reference

One table for every form you will actually use.

FormCodeWhere it goes
Direct character2HTML text (default choice)
Hex entity2HTML markup
Decimal entity2HTML markup
CSS escape\0032Stylesheet content
Named entity—Not defined in HTML5

When to use which

SituationUse
Normal paragraphs, headings, labelsType 2
Need an entity in HTML source2 or 2
Generated text via ::before / ::aftercontent: "\0032"
Looking for &two; or similarDoes not exist — use numeric form

Live Preview

Digit two rendered in common UI contexts.

Inline text You have 2 new notifications.
Large glyph 2
Date / time 2026-05-02 12:20
Monospace index 2, value 2
With entities Hex: 2 | Decimal: 2

Complete HTML Example

One page that shows digit two with the hex entity, decimal entity, CSS escape, and a typed character. Use View Output or open the live editor.

Hex + Decimal + CSS + Typed

All four ways to produce 2 in a single document.

html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Digit Two (2) in HTML</title>
  <style>
    #point::after {
      content: "\0032";
    }
  </style>
</head>
<body>
  <p>Digit Two using Hex Code: &#x32;</p>
  <p>Digit Two using HTML Code: &#50;</p>
  <p id="point">Digit Two using CSS Entity: </p>
  <p>Typed directly: 2</p>
</body>
</html>
Try It Yourself

How It Works

1. Hex: U+0032 → &#x32; in HTML. The browser turns it into 2.

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

3. CSS: use \0032 in content (not an HTML entity). #point::after appends that 2 after the paragraph text.

4. Typed 2: best for normal text. All four lines show the same digit.

Pitfalls & Tips

Common mistakes when working with digit two entities.

Named?

No &two;

HTML5 does not define a named entity for ASCII digits. Use numeric forms.

CSS vs HTML

Do not mix escapes

\0032 belongs in CSS. &#x32; / &#50; belong in HTML.

² vs ₂

Related forms differ

Superscript ² and subscript ₂ are different Unicode characters — not the same as U+0032.

Default

Type 2 when you can

Entities are for encoding needs — not required for ordinary body text.

Semicolon

End references

Always finish with ; — write &#50;, not &#50.

CSS escape

Pad short hex

In CSS content, prefer \0032 (six hex digits) so the escape does not swallow the next character.

Browser Support

Digit two (U+0032) and its numeric entity forms (&#x32;, &#50;, CSS \\0032) are supported in all mainstream browsers.

✓ Universal support

Digit Two (2)

Type 2, or encode with hex, decimal, or CSS escape — same glyph everywhere.

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+0032 / entities Full support

Bottom line: Use a typed 2 for normal text. Prefer &#x32; or &#50; in HTML when encoding must be explicit, and \\0032 only inside CSS content.

Key Takeaways

  • Unicode: digit two is U+0032 (decimal 50).
  • HTML: use &#x32; or &#50; when you need an entity.
  • CSS: use \0032 inside content for generated text.
  • Default: type 2 directly unless encoding requires an entity.

One line: U+0032 → type 2, or encode as &#x32; / &#50; / CSS \0032.

Frequently Asked Questions

Use &#x32; (hex), &#50; (decimal), or the CSS escape \0032 in the content property. All render the digit two (2). In most cases you can also type 2 directly.
U+0032 (hex 0032, decimal 50). It belongs to the Basic Latin (ASCII) block.
No. ASCII digits like 2 do not have named HTML entities in HTML5, so you should use numeric references like &#50; or &#x32; when you need an entity form.
Use entities when generating content in CSS, when you want explicit encoding, or when outputting into contexts where escaping is required. For normal body text, typing 2 directly is usually best.
HTML entities (&#50; or &#x32;) go in markup. The CSS escape \0032 is used in stylesheets (usually in the content property of ::before/::after). Both render 2.
Those are different characters: superscript two is ² (U+00B2) and subscript two is ₂ (U+2082). Digit two itself remains U+0032.

Did you know?

Digit two is Unicode U+0032 (decimal 50). HTML5 has no named entity for it — use &#x32; or &#50; when you need an entity form.

Next: 2 Dingbat Circled Sans Serif

Learn the HTML entity for dingbat circled sans-serif digit two (➁) — a different Unicode character from digit two.

2 Dingbat Circled Sans Serif tutorial →

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