HTML Entity for Underscore (_)

Beginner
5 min read
Updated: Sep 2026
1 example
Unicode U+005F

What Is the Underscore Entity?

Underscore (_) is the Basic Latin character at Unicode U+005F (LOW LINE). It is the standard ASCII underscore used in snake_case, IDs, and file names.

Remember
Character     _
Unicode       U+005F
Hex entity    _
Decimal       _
Named entity  _
CSS escape    \5F
Not the same  U+0332 (combining) · ‿ (undertie)

All of these produce the same glyph: _. Prefer typing _ in normal HTML. Use _ when you want an explicit entity.

Quick Reference

One table for every form you will actually use.

FormCodeWhere it goes
Direct character_UTF-8 HTML text (usual default)
Named entity_HTML markup (explicit entity)
Hex entity_HTML markup
Decimal entity_HTML markup
CSS escape\5FStylesheet content

When to Use Which

SituationUse
Normal HTML / code samplesType _
Readable named entity_
Need a numeric entity_ or _
Generated text via ::before / ::aftercontent: "\5F"
Combining underline effectUse ̲ (U+0332)
Word separator in CSS IDs/classesPrefer hyphen - or underscore _

Live Preview

Underscore in common programming contexts.

snake_case user_name
Large glyph _
Named entity _ → _
vs - / ‿ _  |  -  |  ‿
With entities Hex: _ | Decimal: _ | Named: _

Complete HTML Example

One page that shows this symbol with hex, decimal, named, and CSS. Use View Output or open the live editor.

Hex + Decimal + Named + CSS

All four ways to produce _ in a single document (plus a typed sample).

html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Underscore (_)</title>
  <style>
    #point::after {
      content: "\5F";
    }
  </style>
</head>
<body>
  <p>Using Hex Code: &#x5F;</p>
  <p>Using HTML Code: &#95;</p>
  <p>Using Named Entity: &lowbar;</p>
  <p id="point">Using CSS Entity: </p>
  <p><code>user_name</code></p>
</body>
</html>
Try It Yourself

How It Works

1. Hex: U+005F → &#x5F; in HTML. The browser turns it into _.

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

3. Named: &lowbar; is the HTML5 name for this character (alias &UnderBar;).

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

5. Typed: user_name shows the everyday approach — just type _ in UTF-8 source.

Pitfalls & Tips

Common mistakes when working with Underscore.

Look-alikes

_ ≠ combining underline ≠ ‿

U+005F is a spacing low line. Combining low line (U+0332) attaches under letters. Undertie (U+203F) is a different punctuation mark.

Default

Type _ in normal HTML

Entities are optional here. Use &lowbar; when you want encoding to be visible in the source.

CSS classes

Spaces are invalid

Use _ or - in class and ID names — never spaces.

CSS vs HTML

Do not mix escapes

\5F belongs in CSS. &lowbar; / &#x5F; / &#95; belong in HTML.

A11y

Read as punctuation

Screen readers often say “underscore.” Prefer clear words nearby when the mark carries meaning alone.

Semicolon

End references

Always finish with ; — write &lowbar;, not &lowbar.

Browser Support

Underscore (U+005F) and its entity forms (&lowbar;, &#x5F;, &#95;, CSS \\5F) are supported in all modern browsers as a Basic Latin / ASCII character.

✓ Universal encoding

Underscore (_)

Encode with named, hex, decimal, or CSS escape — or type _ directly in UTF-8 HTML.

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
Yes
U+005F / &lowbar; Full support

Bottom line: Prefer typing _ in normal HTML. Use &lowbar; when an explicit entity helps, and \\5F only inside CSS content.

Key Takeaways

  • Unicode: this symbol is U+005F (decimal 95).
  • HTML: type _, or use &lowbar; / &#x5F; / &#95;.
  • CSS: use \5F inside content for generated text.
  • Watch out: _ ≠ combining U+0332 ≠ undertie U+203F.

One line: U+005F → type _ / &lowbar; / &#x5F; / &#95; / CSS \5F.

Frequently Asked Questions

Use &lowbar; (named), &#x5F; (hex), &#95; (decimal), or the CSS escape \5F in the content property. You can also type _ directly in UTF-8 HTML — that is the usual approach.
U+005F (LOW LINE). Hex 5F, decimal 95. It belongs to Basic Latin (U+0000–U+007F).
Yes. &lowbar; is the HTML5 named entity (alias &UnderBar;). You can also use &#x5F; or &#95;.
Use an entity when you want encoding to be explicit in tutorials or generated markup. In everyday HTML, typing _ is fine for snake_case, IDs, and code samples.
HTML entities (&lowbar;, &#95;, or &#x5F;) go in markup. The CSS escape \5F is used in stylesheets (usually in the content property of ::before/::after). Both render _.
The ASCII underscore _ (U+005F) is a spacing character. Combining low line (U+0332) attaches under the previous letter for underlining effects. They are different code points.

Did you know?

Underscore is Unicode U+005F (decimal 95) — LOW LINE. HTML5 provides &lowbar; (alias &UnderBar;). Prefer typing _ directly in UTF-8 HTML. Do not confuse it with the combining low line U+0332 or the undertie U+203F (‿).

Next: Undertie

Learn the HTML entity for Undertie — next in this sequence.

Continue tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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