HTML Entity for Ampersand (&)

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

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 (&)

Unicode U+0026

Basic Latin (ASCII)

Hex Code &

Hexadecimal reference

HTML Code &

Decimal reference

Named Entity &

Preferred in HTML text and attributes

Reference Table
Name           Value
────────────   ──────────
Unicode        U+0026
Hex code       &
HTML code      &
Named entity   &
CSS code       \0026
1

Complete HTML Example

This example shows the ampersand using hexadecimal, decimal, the named entity &, and a CSS content escape:

html
<!DOCTYPE html>
<html>
<head>
 <style>
  #point:after{
   content: "\0026";
  }
 </style>
</head>
<body>

<p>Ampersand using Hexa Decimal: &#x26;</p>
<p>Ampersand using HTML Code: &#38;</p>
<p>Ampersand using HTML Entity: &amp;</p>
<p id="point">Ampersand using CSS Entity: </p>

</body>
</html>
Try It Yourself

🌐 Browser Support

&amp;, 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:

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

👀 Live Preview

See U+0026 in typical snippets (all render the same character):

Named Smith & Co.
Numeric Rock & roll — same as Rock & roll
Query string search.html?q=1&amp;sort=name (in HTML source, use &amp; before sort)
Monospace U+0026 AMPERSAND
Tip Prefer your framework’s HTML escaper for dynamic text so & is never left raw by mistake.

🧠 How It Works

1

Named entity

&amp; is the usual way to output a literal & in HTML. The first & starts the reference; amp names it; the closing ; ends it.

HTML markup
2

Numeric references

&#38; (decimal) and &#x26; (hex) resolve to the same code point U+0026.

HTML markup
3

CSS escape

\0026 (or \26) in content on ::before / ::after inserts U+0026 from a stylesheet.

CSS 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:

🏢 Brands & titles

Names like “Smith & Co.” or “Johnson & Johnson” in headings and body copy.

🔗 URLs in HTML

href values with multiple query parameters: ?a=1&amp;b=2 in the HTML source (browser sends &).

📝 Prose

Phrases such as “rock & roll” or “R&D” in articles and UI strings.

⚙️ Forms & attributes

Literal & inside value, placeholder, or data attributes without breaking the parser.

📚 Docs & examples

Teaching markup: show entity syntax without the browser interpreting your sample as a real reference.

🔐 Dynamic content

Escape user-supplied text so stray & does not corrupt the DOM or enable injection.

♿ Accessibility

Valid, escaped markup avoids parser recoveries that confuse assistive tech or hide text.

💡 Best Practices

Do

  • Use &amp; (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 &amp; between query parameters in the HTML file
  • Use \0026 in CSS content when you cannot embed raw UTF-8

Don’t

  • Leave raw & before text that could be parsed as an entity name (e.g. &copy 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

1

Named + numeric ways to write U+0026

&amp; &#38; &#x26;
2

CSS content escape

\0026
3

Unicode U+0026 — ampersand

4

Reserved in HTML — always escape for a literal glyph

5

One of the five predefined XML/HTML character entities

❓ Frequently Asked Questions

Use &amp; (named), &#38; or &#x26; (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.
The tokenizer treats & as the start of a character reference. If what follows is not a valid reference, you can get validation errors or unexpected nodes.
&amp; / numeric refs belong in HTML (and SVG text). Backslash hex escapes belong in CSS property values such as content.
Yes. It is predefined in XML and universally recognized in HTML for the ampersand character itself.

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