HTML Entities & Special Characters
How to show characters that HTML treats as code, like the angle brackets and the ampersand, by escaping them into entities.
What it is
A few characters are part of HTML's own syntax. < starts a tag, & starts an entity, and " delimits an attribute value. If you type those literally as content, the browser tries to read them as markup instead of showing them.
An entity is the escaped form of such a character. Every entity starts with an ampersand and ends with a semicolon, like < for < or & for &. You write the entity, and the browser renders the single real character.
Why it matters
The classic version of this bug is trying to show a code example in a tutorial. You type The <strong> tag and the word and its brackets vanish, because the browser turned <strong> into a real element. Entities are how you put literal HTML, math, and symbols on the page as text.
It is also a correctness issue in everyday content. An unescaped ampersand in a sentence or a URL can quietly confuse the parser, so knowing which characters to escape keeps your text reliable.
How it works
To show a reserved character as text, replace it with its entity: < becomes <, > becomes >, and & becomes &. Inside an attribute value you also escape the matching quote with " or '. The ampersand is the one people forget, and it is the most important, because it is what begins every entity.
Entities come in two forms. A named entity like © is easy to read, but not every character has a name. A numeric entity works for any Unicode character at all: decimal © or hexadecimal © both render the copyright sign, exactly like ©.
is a special one: a non-breaking space that keeps two words or a label and its value from splitting across lines, like Price: 999. Beyond these, because your files are UTF-8, you can usually just type symbols such as the copyright sign, arrows, or the euro directly and they render fine.
Code in, glyph out
On the left, the entities you type inside real content. On the right, the single character the browser renders for each one.
<<less than>>greater than&&ersand©©copyright→→right arrow××times / closeNamed or numeric, same result: © = © = © = ©
You type the entity; the browser renders the character.
Check yourself
Pick an answer to lock it in, then read why. Getting one wrong is part of how it sticks.
Remember this
- Reserved characters (
<,>,&, and"in attributes) must be escaped, or the browser reads them as HTML. - An entity starts with
&and ends with;:<is<,>is>,&is&. - Numeric entities like
©or©work for any Unicode character; named ones like©just read more clearly. is a space that never breaks across lines; in UTF-8 you can type most other symbols directly.
Done with this concept?
Mark it complete to track your progress. No login needed.