More
More
Ampersand HTML entity &
& is the HTML entity for Ampersand & (U+0026). Copy the decimal & and hex & codes plus CSS, JavaScript, Python and URL escapes.
- Entity
&- Also written
&- Legacy form
&(no semicolon)- Code point
- U+0026
- Unicode name
- AMPERSAND
- Block
- Basic Latin
- Category
- Other punctuation (Po)
- Since
- Unicode 1.1
- Defined in
- HTML 4.01 and HTML5, and predefined in XML
Codes to copy
| HTML named | &Works in HTML; in XML only & < > " ' are predefined. | |
|---|---|---|
| HTML decimal | &Works in HTML and XML. | |
| HTML hex | &Works in HTML and XML. | |
| CSS | content: "\26";In a stylesheet, for ::before and ::after. | |
| JavaScript | "\u0026"Also valid in JSON. | |
| Python | "\u0026"Python 3 string literal. | |
| Python by name | "\N{AMPERSAND}"Readable alternative using the Unicode name. | |
| URL | %26Percent-encoded UTF-8 bytes, for a path or query value. | |
| UTF-8 bytes | 261 byte. | |
| UTF-16 | 00261 code unit, which is what JavaScript length counts. |
When to use it
The ampersand starts every character reference, so a literal & in HTML is safest written as &. In text, an & followed by letters that happen to spell an entity name (such as ©) can be read as that character, and validators flag an unescaped ampersand in links such as href="?a=1&b=2". It is one of the five characters predefined in XML.
The name dates from HTML 4, so it works in every browser and in old email clients.
Browsers also accept the legacy form & without a semicolon, for compatibility with old pages; new HTML should always end the reference with a semicolon.
More html syntax and ascii punctuation
(Left Parenthesis$Dollar Sign)Right Parenthesis#Number Sign*Asterisk"Quotation Mark+Plus Sign!Exclamation Mark
All html syntax and ascii punctuation · Every HTML entity · Encode or decode text
Source: the WHATWG HTML Standard list of named character references and the Unicode Character Database (Unicode 18.0).