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.
Reference
Quick Reference
One table for every form you will actually use.
Form
Code
Where it goes
Direct character
4
HTML text (default choice)
Hex entity
4
HTML markup
Decimal entity
4
HTML markup
CSS escape
\0034
Stylesheet content
Named entity
—
Not defined in HTML5
When to use which
Situation
Use
Normal paragraphs, headings, labels
Type 4
Need an entity in HTML source
4 or 4
Generated text via ::before / ::after
content: "\0034"
Looking for &four; or similar
Does not exist — use numeric form
See it
Live Preview
Digit four rendered in common UI contexts.
Inline textYou have 4 unread emails.
Large glyph4
Date / time2026-04-14 14:40
Monospaceindex 4, value 4
With entitiesHex: 4 | Decimal: 4
Code
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: 4</p>
<p>Digit Four using HTML Code: 4</p>
<p id="point">Digit Four using CSS Entity: </p>
<p>Typed directly: 4</p>
</body>
</html>
Digit Four using Hex Code: 4
Digit Four using HTML Code: 4
Digit Four using CSS Entity: 4
Typed directly: 4
How It Works
1. Hex:U+0034 → 4 in HTML. The browser turns it into 4.
2. Decimal: same code point as 52 → 4. 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. 4 / 4 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 4, not 4.
CSS escape
Pad short hex
In CSS content, prefer \0034 (six hex digits) so the escape does not swallow the next character.
Compatibility
Browser Support
Digit four (U+0034) and its numeric entity forms (4, 4, 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 ChromeSupported
Yes
Microsoft EdgeSupported
Yes
Mozilla FirefoxSupported
Yes
Apple SafariSupported
Yes
OperaSupported
Yes
Internet ExplorerAll versions
Yes
U+0034 / entitiesFull support
Bottom line: Use a typed 4 for normal text. Prefer 4 or 4 in HTML when encoding must be explicit, and \\0034 only inside CSS content.
Remember
Key Takeaways
Unicode: digit four is U+0034 (decimal 52).
HTML: use 4 or 4 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 4 / 4 / CSS \0034.
Frequently Asked Questions
Use 4 (hex), 4 (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 4 or 4 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 (4 or 4) 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 4 or 4 when you need an entity form.