<
Displays the less-than character: <
Learn HTML Entities as a practical HTML text lesson with syntax, examples, common mistakes, accessibility notes and a live code lab.
HTML text basics
Some characters have a special meaning in HTML. The less-than sign starts a tag. The ampersand starts an entity. If you want to show those characters as text, you must escape them.
Entities can be named, such as &lt;, or numeric, such as &#60;. In normal modern pages, UTF-8 lets you type many characters directly, but reserved characters still need care.
The most common entities are the ones that protect markup: &lt; for <, &gt; for > and &amp; for &.
Displays the less-than character: <
Displays the greater-than character: >
Displays the ampersand character: &
Displays a double quote inside contexts where it must be escaped.
Displays an apostrophe. Support is fine in HTML5.
Creates a non-breaking space. Use sparingly.
Syntax and meaning
Entities are especially important inside code examples, text that contains angle brackets and generated HTML output.
<p>Write <h1> for the main heading element.</p> <p>Tom & Jerry uses an escaped ampersand.</p> <p>The price is 10 EUR so the number and unit stay together.</p>
<p>Write <h1> for the main heading element.</p> <p>Tom & Jerry uses an unescaped ampersand.</p> <p>Use non-breaking spaces for every space.</p>
Practical rules
These rules are the part that saves time in real projects. If the HTML meaning is clean, CSS, JavaScript, accessibility checks and search optimization become easier to reason about.
Use < and > when showing HTML tags as text.
Use & when the ampersand is literal text, especially in generated markup.
Modern pages can usually store symbols, accents and international text directly when charset is UTF-8.
Non-breaking spaces can hurt responsive layouts when overused.
If content comes from users or databases, escape output to prevent broken markup and security issues.
Escaping rules differ between HTML text, attributes, URLs, CSS and JavaScript.
Production thinking
Text markup matters because browsers and assistive technology do not only see letters. They also read structure, emphasis, quotes, code and relationships between pieces of text.
Entities render as characters, so assistive technology reads the resulting character, not the entity name.
Output escaping is a security habit. In PHP, for example, htmlspecialchars protects HTML text and attributes when used correctly.
Entities are normal characters after parsing. Use them for correctness, not as a ranking trick.
Live code lab
Edit the HTML or CSS, then use Run to refresh the preview. The preview is isolated, so links and forms stay inside this practice area.
Mini assignment
Practice assignment
Try it yourself
Self-check
Do not only read this page. Answer these questions out loud or write the answers in your own notes. If one answer feels vague, revisit the examples before moving on.