HTML Entity for Underscore (_)

What You'll Learn
How to display the underscore (_) in HTML using named, hexadecimal, decimal, and CSS entity methods. This character is U+005F (LOW LINE) in the Basic Latin block—a standard ASCII character essential for code snippets, variable names, snake_case naming, CSS classes, HTML IDs, and file naming conventions.
Render it with _, _, _, or CSS escape \5F. You can also type _ directly in most HTML. Do not confuse with the combining low line (U+0332) used for underlining text.
⚡ Quick Reference — Underscore
U+005FBasic Latin (ASCII)
_Hexadecimal reference
_Decimal reference
_Standard HTML entity
Name Value
──────────── ──────────
Unicode U+005F
Hex code _
HTML code _
Named entity _
CSS code \5F
Direct _ (type on keyboard)
Official name LOW LINE
Related U+0332 = combining low line (̲)
Block Basic Latin (U+0000–U+007F)Complete HTML Example
A simple example showing _ using the named entity, hexadecimal code, decimal HTML code, and a CSS content escape:
<!DOCTYPE html>
<html>
<head>
<style>
#point::after{
content: "\5F";
}
</style>
</head>
<body>
<p>Underscore (named): _</p>
<p>Underscore (hex): _</p>
<p>Underscore (decimal): _</p>
<p id="point">Underscore (CSS): </p>
</body>
</html>🌐 Browser Support
U+005F is universally supported in all browsers and fonts as a standard ASCII character:
👀 Live Preview
See the underscore (_) in programming and web contexts:
🧠 How It Works
Named HTML Entity
_ is the most readable explicit method for displaying the underscore. Useful in code examples and contexts where you want clear encoding.
Hexadecimal Code
_ uses the Unicode hexadecimal value 5F to display the underscore character.
Decimal HTML Code
_ uses the decimal Unicode value 95 to display the same character.
CSS Entity
\5F is used in CSS stylesheets in the content property of pseudo-elements like ::before and ::after.
Same visual result
All four methods produce: _. Unicode U+005F (LOW LINE) in Basic Latin. You can also type _ directly. Serve HTML as UTF-8.
Use Cases
The underscore (_) is commonly used in:
Programming examples, tutorials, and technical documentation.
snake_case identifiers in Python, Ruby, and other languages.
CSS class names, HTML IDs, and BEM-style naming conventions.
URL slugs, file paths, and database table or column names.
Word separation, emphasis, and fill-in-the-blank forms.
ASCII and HTML entity reference guides for beginners.
💡 Best Practices
Do
- Type
_directly in most HTML—it is standard ASCII - Use
_in code examples when showing explicit entity encoding - Use
font-family: monospacefor code and identifier examples - Follow snake_case consistently in programming examples
- Serve pages with UTF-8 (
<meta charset="utf-8">)
Don’t
- Confuse _ (U+005F low line) with combining low line (U+0332)
- Use U+0005F or CSS
\0005F—the correct value is U+005F and\5F - Put CSS escape
\5Fin HTML text nodes - Use spaces in CSS class names—use hyphens or underscores instead
- Over-encode ASCII when typing _ directly is clear and sufficient
Key Takeaways
Named entity renders _
_Numeric HTML references also work
_ _For CSS stylesheets, use \5F in content
Unicode U+005F — LOW LINE (underscore)
Standard ASCII—type _ directly in most HTML
❓ Frequently Asked Questions
_ (named), _ (hex), _ (decimal), or \5F in CSS content. You can also type _ directly. All produce _.U+005F (LOW LINE). Basic Latin block. Hex 5F, decimal 95, named entity _. A standard ASCII character used throughout programming and web development._ is explicit and readable in entity tutorials. Numeric codes (_ or _) work everywhere. Typing _ directly is the simplest approach in normal HTML prose._ provides explicit encoding when needed, though typing _ directly works in most HTML contexts.Explore More HTML Entities!
Discover 1500+ HTML character references — ASCII, punctuation, symbols, and more.
8 people found this page helpful
