& — Ampersand
& is the named character reference for the ampersand, code point 38.
Written as a decimal reference it is &; as a hexadecimal reference, &.
All three resolve to the same glyph, and the choice between them is about what survives your toolchain rather than about meaning.
&&&Which form to write
Named references are readable and self-documenting, which is why hand-written markup uses them. Numeric references — decimal or hexadecimal — are unambiguous and immune to entity-table gaps, which is why generators, serialisers and sanitisers prefer them. HTML5 recognises the named form in both HTML and XHTML syntax, and browsers resolve any of the three identically at render time.
| Form | Bytes | Survives | Typical producer |
|---|---|---|---|
& | 5 | Any HTML5 parser | Hand-written templates |
& | 5 | Every HTML and XML parser | Older escape libraries |
& | 6 | Every HTML and XML parser | Modern serialisers |
What this site's encoder does with it
Paste the ampersand into the encoder and pick a style: with named selected the output is &.
That is the named form, because this character sits in the small set the encoder must escape no matter what.
This character is one of the handful that must always be escaped. Left raw inside text or an attribute it changes how the document is parsed rather than what it displays.
Mistakes worth avoiding
- Double escaping. Writing
&in source produces the literal text&on the page instead of the character. Escape once, at the boundary where data becomes markup. - Missing semicolon. Inside attributes the parser may still resolve a reference without its semicolon when the next character is not alphanumeric, but trusting that is how broken output reaches production.
- Escaping inside <script>. Entity references are not decoded in script or style content, so an escaped value there stays literal and breaks the code rather than the markup.
Questions about &
What is & in decimal and hex?
Decimal &, hexadecimal &. All three reference code point 38 and render the same character, “&”.
Do I have to use the named form?
In text content only the ampersand and the angle brackets are compulsory; everything else is optional. Named forms are easier to read in source and that is the main reason to prefer them.
Which form does this site's encoder output for &?
It emits & when the named style is selected, because this character is one of the four with a mandatory escape.
Where does & break?
It breaks when the surrounding text already assumes an ASCII-only pipeline. Some legacy systems re-encode the ampersand, turning one entity into two and exposing the raw code in the rendered page.