HTML Entity for Backslash (\)

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

What You'll Learn

How to display the backslash (\, Unicode U+005C, reverse solidus) in HTML using the standard named reference, numeric character references, and CSS escapes. This ASCII character appears in Windows-style paths, escape sequences, regular expressions, and code-oriented documentation.

The named entity \ is usually the clearest in markup. You can also use \ or \, and \5C in stylesheet content rules.

⚡ Quick Reference — Backslash

Unicode U+005C

Basic Latin (ASCII)

Hex Code \

Hexadecimal reference

HTML Code \

Decimal reference

Named Entity \

Reverse solidus (readable)

Reference Table
Name           Value
────────────   ──────────
Unicode        U+005C
Hex code       \
HTML code      \
Named entity   \
CSS code       \5C
1

Complete HTML Example

This example demonstrates the backslash using hexadecimal code, decimal code, the named entity \, and a CSS content escape on a pseudo-element:

html
<!DOCTYPE html>
<html>
<head>
 <style>
  #point:after{
   content: "\5C";
  }
 </style>
</head>
<body>
<p>Backslash using Hexa Decimal: &#x5C;</p>
<p>Backslash using HTML Code: &#92;</p>
<p>Backslash using HTML Entity: &bsol;</p>
<p id="point">Backslash using CSS Entity: </p>
</body>
</html>
Try It Yourself

🌐 Browser Support

The backslash is universal in HTML and CSS across all major browsers:

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

👀 Live Preview

See the backslash rendered live in different contexts:

Path fragment C:\Users\Docs
Large glyph \
Named entity word1\word2
Escape hint Line\nTab\t (displayed as literals here)
Inline prose Use a backslash (\) when your copy shows Windows paths or regex.

🧠 How It Works

1

Hexadecimal Code

&#x5C; references code point U+005C using hex digits 5C after the #x prefix.

HTML markup
2

Decimal HTML Code

&#92; is the decimal ASCII value 92 for the same reverse solidus character.

HTML markup
3

Named Entity

&bsol; is the HTML5 named character reference for reverse solidus and is often the most readable option in tutorials and docs.

HTML markup
4

CSS Entity

\5C is the CSS escape for U+005C, used in the content property of ::before or ::after.

CSS stylesheet
=

Same visual result

All four methods produce the backslash: \. In JSON-LD or JavaScript string literals you will often write \\ to mean one \ — that is language escaping, not HTML entities.

Use Cases

The backslash commonly appears when you need to show:

📁 File paths

Windows-style directories, UNC fragments, and command-line examples in documentation.

💻 Code & escapes

String escapes (\n, \t), regex snippets, and language syntax callouts.

📘 Technical writing

API docs, README excerpts, and tutorials that must show literal backslashes.

🔗 Namespaces & IDs

Some identifiers or legacy patterns that use reverse solidus as a separator.

🎨 CSS content

Injecting a visible backslash from a stylesheet via \5C on pseudo-elements.

🌐 Encoding demos

Teaching character references alongside ASCII control and printable charts.

♿ Accessibility

Pair path or code samples with labels (“Windows path,” “escape character”) so assistive tech users get context.

💡 Best Practices

Do

  • Prefer &bsol; in hand-authored HTML for clarity
  • Use entities inside attributes when a raw \ would confuse parsers or serializers
  • Keep one style (named vs numeric) per document section
  • Use <pre><code> for multi-line paths and escape tables
  • Remember CSS needs \5C, not HTML numeric refs, inside content

Don’t

  • Confuse the reverse solidus with the ordinary slash / (solidus)
  • Double-escape in JSON or JS demos without explaining \\ vs HTML entities
  • Mix arbitrary backslashes into HTML tag syntax (breaks attributes)
  • Assume every font redraws \ with identical width in monospace layouts
  • Use CSS escapes inside HTML text nodes

Key Takeaways

1

Four references all render the ASCII backslash

&#x5C; &#92; &bsol;
2

In CSS content, use the escape

\5C
3

Unicode U+005C lives in Basic Latin and is the reverse solidus

4

Use entities when you need a visible backslash without risking markup ambiguity

5

In programming strings, \\ still means “one backslash”—separate from HTML entities

❓ Frequently Asked Questions

Use &bsol; (named), &#x5C; (hex), &#92; (decimal), or \5C in CSS content. All valid methods render a single backslash.
U+005C (hex 5C, decimal 92). It is the reverse solidus in the Basic Latin block.
Whenever page copy must show literal Windows paths, escape syntax, regex, or programming examples that include \.
HTML character references belong in markup. The \5C escape belongs in stylesheets (for example on pseudo-elements). Do not paste CSS escapes into HTML text nodes.
Yes: &bsol; (“reverse solidus”). Hex and decimal numeric references are equivalent alternatives.

Explore More HTML Entities!

Discover 1500+ HTML character references — currency symbols, arrows, math operators, emojis, 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