HTML Entity for Underscore (_)

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 1 Code Example
Unicode U+005F

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

Unicode U+005F

Basic Latin (ASCII)

Hex Code _

Hexadecimal reference

HTML Code _

Decimal reference

Named Entity _

Standard HTML entity

Reference Table
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)
1

Complete HTML Example

A simple example showing _ using the named entity, hexadecimal code, decimal HTML code, and a CSS content escape:

html
<!DOCTYPE html>
<html>
<head>
 <style>
  #point::after{
   content: "\5F";
  }
 </style>
</head>
<body>
<p>Underscore (named): &lowbar;</p>
<p>Underscore (hex): &#x5F;</p>
<p>Underscore (decimal): &#95;</p>
<p id="point">Underscore (CSS): </p>
</body>
</html>
Try it Yourself

🌐 Browser Support

U+005F is universally supported in all browsers and fonts as a standard ASCII character:

Chrome 1+
Firefox 1+
Safari 1+
Edge 12+
Opera 4+
Android 4.4+
iOS Safari 1+

👀 Live Preview

See the underscore (_) in programming and web contexts:

Large glyph _
snake_case user_name
CSS class .nav_item_active
File name my_file_name.txt
Numeric refs &#x5F; &#95; &lowbar;

🧠 How It Works

1

Named HTML Entity

&lowbar; is the most readable explicit method for displaying the underscore. Useful in code examples and contexts where you want clear encoding.

HTML markup
2

Hexadecimal Code

&#x5F; uses the Unicode hexadecimal value 5F to display the underscore character.

HTML markup
3

Decimal HTML Code

&#95; uses the decimal Unicode value 95 to display the same character.

HTML markup
4

CSS Entity

\5F is used in CSS stylesheets in the content property of pseudo-elements like ::before and ::after.

CSS stylesheet
=

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:

💻 Code snippets

Programming examples, tutorials, and technical documentation.

📝 Variable names

snake_case identifiers in Python, Ruby, and other languages.

🎨 Web design

CSS class names, HTML IDs, and BEM-style naming conventions.

📁 File naming

URL slugs, file paths, and database table or column names.

📄 Text formatting

Word separation, emphasis, and fill-in-the-blank forms.

📚 Education

ASCII and HTML entity reference guides for beginners.

💡 Best Practices

Do

  • Type _ directly in most HTML—it is standard ASCII
  • Use &lowbar; in code examples when showing explicit entity encoding
  • Use font-family: monospace for 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 \5F in 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

1

Named entity renders _

&lowbar;
2

Numeric HTML references also work

&#x5F; &#95;
3

For CSS stylesheets, use \5F in content

4

Unicode U+005F — LOW LINE (underscore)

5

Standard ASCII—type _ directly in most HTML

❓ Frequently Asked Questions

Use &lowbar; (named), &#x5F; (hex), &#95; (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 &lowbar;. A standard ASCII character used throughout programming and web development.
In code snippets, variable names, snake_case examples, CSS class names, HTML IDs, file naming conventions, URL slugs, and any content that requires underscore characters.
&lowbar; is explicit and readable in entity tutorials. Numeric codes (&#95; or &#x5F;) work everywhere. Typing _ directly is the simplest approach in normal HTML prose.
U+005F is part of the HTML entity set for ASCII characters. &lowbar; 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.

All HTML Entities →

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