Both are character references and refer to the same character (AMPERSAND, U+0026). & is a named or entity character reference and & is a numerical character reference. & or & what should be used for & (ampersand) if we are using ...

Understanding the Context

In HTML5, they are equivalent in that example. Traditionally, in HTML, only & was correct โ€” but as with so many things, web developers blithely ignored this inconvenient rule and wrote bare ampersands everywhere. For their part, browsers just "did the right thing" and interpreted these ampersands as ampersands. HTML5 standardized this behavior, so now & is allowed by itself as long as ...

Key Insights

What is &amp used for Asked 14 years, 2 months ago Modified 2 years, 8 months ago Viewed 1.1m times Encoding & as & under all circumstances, for me, is an easier rule to live by, reducing the likelihood of errors and failures. Compare the following: which is easier? Which is easier to bugger up? Methodology 1 Write some content which includes ampersand characters. Encode them all.

Final Thoughts

Methodology 2 (with a grain of salt, please ;) ) & is the proper way to escape the ampersand in an HTML context...where is your source coming from? and what's the destination? It may be better to do this server-side for example.