HTML Entity for Backslash (\)

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
U+005CBasic Latin (ASCII)
\Hexadecimal reference
\Decimal reference
\Reverse solidus (readable)
Name Value
──────────── ──────────
Unicode U+005C
Hex code \
HTML code \
Named entity \
CSS code \5CComplete HTML Example
This example demonstrates the backslash using hexadecimal code, decimal code, the named entity \, and a CSS content escape on a pseudo-element:
<!DOCTYPE html>
<html>
<head>
<style>
#point:after{
content: "\5C";
}
</style>
</head>
<body>
<p>Backslash using Hexa Decimal: \</p>
<p>Backslash using HTML Code: \</p>
<p>Backslash using HTML Entity: \</p>
<p id="point">Backslash using CSS Entity: </p>
</body>
</html>🌐 Browser Support
The backslash is universal in HTML and CSS across all major browsers:
👀 Live Preview
See the backslash rendered live in different contexts:
🧠 How It Works
Hexadecimal Code
\ references code point U+005C using hex digits 5C after the #x prefix.
Decimal HTML Code
\ is the decimal ASCII value 92 for the same reverse solidus character.
Named Entity
\ is the HTML5 named character reference for reverse solidus and is often the most readable option in tutorials and docs.
CSS Entity
\5C is the CSS escape for U+005C, used in the content property of ::before or ::after.
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:
Windows-style directories, UNC fragments, and command-line examples in documentation.
String escapes (\n, \t), regex snippets, and language syntax callouts.
API docs, README excerpts, and tutorials that must show literal backslashes.
Some identifiers or legacy patterns that use reverse solidus as a separator.
contentInjecting a visible backslash from a stylesheet via \5C on pseudo-elements.
Teaching character references alongside ASCII control and printable charts.
Pair path or code samples with labels (“Windows path,” “escape character”) so assistive tech users get context.
💡 Best Practices
Do
- Prefer
\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, insidecontent
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
Four references all render the ASCII backslash
\ \ \In CSS content, use the escape
\5CUnicode U+005C lives in Basic Latin and is the reverse solidus
Use entities when you need a visible backslash without risking markup ambiguity
In programming strings, \\ still means “one backslash”—separate from HTML entities
❓ Frequently Asked Questions
\ (named), \ (hex), \ (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.\.\5C escape belongs in stylesheets (for example on pseudo-elements). Do not paste CSS escapes into HTML text nodes.\ (“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.
8 people found this page helpful
