HTML Entity for Ampersand (&)

What You'll Learn
How to display a literal ampersand (&) in HTML using the named reference &, numeric & / &, or a CSS escape in content. In HTML, & starts a character reference, so a bare & in text or attribute values is unsafe and often invalid.
The character is U+0026 in Basic Latin. Prefer & in hand-written markup for readability. In href query strings inside HTML, separate parameters with & (e.g. ?a=1&b=2). In CSS, \0026 or \26 emits the same glyph in content on pseudo-elements.
⚡ Quick Reference — Ampersand (&)
U+0026Basic Latin (ASCII)
&Hexadecimal reference
&Decimal reference
&Preferred in HTML text and attributes
Name Value
──────────── ──────────
Unicode U+0026
Hex code &
HTML code &
Named entity &
CSS code \0026Complete HTML Example
This example shows the ampersand using hexadecimal, decimal, the named entity &, and a CSS content escape:
<!DOCTYPE html>
<html>
<head>
<style>
#point:after{
content: "\0026";
}
</style>
</head>
<body>
<p>Ampersand using Hexa Decimal: &</p>
<p>Ampersand using HTML Code: &</p>
<p>Ampersand using HTML Entity: &</p>
<p id="point">Ampersand using CSS Entity: </p>
</body>
</html>🌐 Browser Support
&, numeric references, and CSS escapes for U+0026 are supported in every HTML-capable browser. The glyph is always present in standard fonts because it is ASCII:
👀 Live Preview
See U+0026 in typical snippets (all render the same character):
search.html?q=1&sort=name (in HTML source, use & before sort)& is never left raw by mistake.🧠 How It Works
Named entity
& is the usual way to output a literal & in HTML. The first & starts the reference; amp names it; the closing ; ends it.
Numeric references
& (decimal) and & (hex) resolve to the same code point U+0026.
CSS escape
\0026 (or \26) in content on ::before / ::after inserts U+0026 from a stylesheet.
Same code point
All paths yield U+0026 (ampersand). It is one of the five predefined XML entities; escaping is required when you mean a literal & in serialized HTML.
Use Cases
You will use escaped ampersands constantly in real pages:
Names like “Smith & Co.” or “Johnson & Johnson” in headings and body copy.
href values with multiple query parameters: ?a=1&b=2 in the HTML source (browser sends &).
Phrases such as “rock & roll” or “R&D” in articles and UI strings.
Literal & inside value, placeholder, or data attributes without breaking the parser.
Teaching markup: show entity syntax without the browser interpreting your sample as a real reference.
Escape user-supplied text so stray & does not corrupt the DOM or enable injection.
Valid, escaped markup avoids parser recoveries that confuse assistive tech or hide text.
💡 Best Practices
Do
- Use
&(or numeric refs) for literal&in HTML text and attribute values - Run validators or linters to catch stray
&before<that are not part of a valid reference - Let templates and frameworks auto-escape text nodes by default
- In
href, write&between query parameters in the HTML file - Use
\0026in CSScontentwhen you cannot embed raw UTF-8
Don’t
- Leave raw
&before text that could be parsed as an entity name (e.g.©without;) - Double-escape already-safe UTF-8 unless your pipeline requires it
- Paste CSS escapes into HTML text (wrong layer)
- Assume URL copy-pasted from the address bar is safe to drop into HTML without encoding other reserved characters
- Forget that attribute values in double quotes still need
&escaped
Key Takeaways
Named + numeric ways to write U+0026
& & &CSS content escape
\0026Unicode U+0026 — ampersand
Reserved in HTML — always escape for a literal glyph
One of the five predefined XML/HTML character entities
❓ Frequently Asked Questions
& (named), & or & (numeric), or UTF-8 with a correctly escaped serializer. For CSS-only text, \0026 in content works.U+0026 (decimal 38, hex 26). Basic Latin; universal font coverage.& as the start of a character reference. If what follows is not a valid reference, you can get validation errors or unexpected nodes.& / numeric refs belong in HTML (and SVG text). Backslash hex escapes belong in CSS property values such as content.Explore More HTML Entities!
Discover 1500+ HTML character references — currency symbols, arrows, math operators, emojis, and more.
8 people found this page helpful
