To display the literal text & in an HTML page, write & in the HTML source. The browser interprets the first ampersand as the start of a character reference and renders the visible text &.
What to write in the HTML source
HTML source and rendered text are different: the browser parses character references in the source before displaying the result.
As an Amazon Associate I earn from qualifying purchases.
| HTML source | Rendered text |
|---|---|
& |
& |
& |
& |
For example, this paragraph source:
<p>Write &amp; to show the text &amp;.</p>
renders as:
Write & to show the text &.
In an HTML page, the source needs the additional escaping even inside <code> or <pre>. Those elements affect presentation; they do not stop the browser from parsing character references.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Why the extra escaping works
An ampersand begins an HTML character reference. The named reference & represents the ampersand character, U+00026. So when the browser encounters &amp; in the source, it interprets the first & as one ampersand and displays the remaining letters amp; as ordinary text.
#1 Best Overall
The same result can be produced with a numeric character reference for the initial ampersand: &amp; uses decimal 38, while &amp; uses hexadecimal 26. Both render as &. For this example, &amp; is usually easiest to recognize.
Do not confuse HTML page output with forum code display
Suggestions such as splitting the text with an empty tag may depend on a particular forum’s post renderer. They are not the general solution for outputting the literal spelling in an HTML page. In page markup, escape the ampersand as shown above.
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
What about XHTML or XML?
This explanation is for HTML syntax. XHTML served as XML follows XML parsing rules, so do not assume that every HTML parsing detail applies unchanged. If the document is XML, follow the rules for that serialization.
The HTML Standard describes character references as beginning with a U+0026 ampersand: HTML syntax: character references. MDN lists the named ampersand reference and its code point: Character references.
Quick Recap
Best Value
Rank #4
Rank #3
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




