HTML Entity for Digit Four (4)

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

What Is the Digit Four Entity?

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

Remember
Character     4
Unicode       U+0034
Hex entity    4
Decimal       4
CSS escape    \0034
Named entity  (none)

All of these produce the same glyph: 4. Prefer typing 4 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 character4HTML text (default choice)
Hex entity4HTML markup
Decimal entity4HTML markup
CSS escape\0034Stylesheet content
Named entity—Not defined in HTML5

When to use which

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

Live Preview

Digit four rendered in common UI contexts.

Inline text You have 4 unread emails.
Large glyph 4
Date / time 2026-04-14 14:40
Monospace index 4, value 4
With entities Hex: 4 | Decimal: 4

Complete HTML Example

One page that shows digit four 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 4 in a single document.

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

How It Works

1. Hex: U+0034 → &#x34; in HTML. The browser turns it into 4.

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

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

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

Pitfalls & Tips

Common mistakes when working with digit four entities.

Named?

No &four;

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

CSS vs HTML

Do not mix escapes

\0034 belongs in CSS. &#x34; / &#52; belong in HTML.

Lookalikes

Related forms differ

Circled or dingbat fours (such as ➃) are different Unicode characters — not the same as U+0034.

Default

Type 4 when you can

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

Semicolon

End references

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

CSS escape

Pad short hex

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

Browser Support

Digit four (U+0034) and its numeric entity forms (&#x34;, &#52;, CSS \\0034) are supported in all mainstream browsers.

✓ Universal support

Digit Four (4)

Type 4, 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+0034 / entities Full support

Bottom line: Use a typed 4 for normal text. Prefer &#x34; or &#52; in HTML when encoding must be explicit, and \\0034 only inside CSS content.

Key Takeaways

  • Unicode: digit four is U+0034 (decimal 52).
  • HTML: use &#x34; or &#52; when you need an entity.
  • CSS: use \0034 inside content for generated text.
  • Default: type 4 directly unless encoding requires an entity.

One line: U+0034 → type 4, or encode as &#x34; / &#52; / CSS \0034.

Frequently Asked Questions

Use &#x34; (hex), &#52; (decimal), or the CSS escape \0034 in the content property. All render the digit four (4). In most cases you can also type 4 directly.
U+0034 (hex 0034, decimal 52). It belongs to the Basic Latin (ASCII) block.
No. ASCII digits like 4 do not have named HTML entities in HTML5, so you should use numeric references like &#52; or &#x34; 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 4 directly is usually best.
HTML entities (&#52; or &#x34;) go in markup. The CSS escape \0034 is used in stylesheets (usually in the content property of ::before/::after). Both render 4.
No. Digit four is U+0034. Circled and other stylized fours (such as dingbat circled sans-serif ➃) are different Unicode characters.

Did you know?

Digit four is Unicode U+0034 (decimal 52). HTML5 has no named entity for it — use &#x34; or &#52; when you need an entity form.

Next: 4 Dingbat Circled Sans Serif

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

4 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