In HTML, some characters have special meanings and cannot be written directly without confusing the browser. For example, < and > are used for tags, and & starts an entity. To display these as normal text, we use HTML character entities such as < or &. These tell the browser to show the character instead of treating it as HTML code.
Entities are also helpful for symbols that are not on the keyboard (©, ™, €) or for controlling spacing (like non-breaking spaces). Knowing a few common entities makes your HTML examples safe and readable.
<, >, &).& and ending with ;.< or ©.© (©). keeps text together on one line.< → <> → >& → &" → "' → ' © → ©® → ®™ → ™€ → €— → —
<!-- Display less-than / greater-than symbols inside text -->
<p>If x < 10 and x > 5, then...</p>
<!-- Show common symbols -->
<p>© 2025 MySite — All rights reserved.</p>
<p>Trademark: ™ Registered: ®</p>
<!-- Use entities safely inside attribute values -->
<img alt="2 < 3 is true" src="icon.png">
<!-- Quotes inside attributes -->
<button title="She said "Hello!"">Hover me</button>
If x < 10 and x > 5, then...
© 2025 MySite — All rights reserved.
Trademark: ™ Registered: ®
She said, "Hello!"
Notice how the code safely shows symbols and quotes without breaking the HTML structure. The browser receives entities in the source, but you only see the final characters.
<, >, or &, use <, >, and & in the source." or wrap the attribute with the opposite quote type. to prevent line breaks in small fragments (e.g., “© 2025”), but prefer CSS for layout spacing.© (©) also work if you can’t remember the named entity.<meta charset="UTF-8"> so Unicode characters (€, ✓) render correctly.& in query strings when writing raw HTML (for example, ?q=cats&lang=en in the source).&lt; unless you really want to show the entity code itself.<div class="box"> using the correct entities so it doesn’t become a real element.?q=cats&lang=en) and ensure the & is written as & in the HTML source.title attribute contains quotes using " (for example: title="She said "Hi!""). only where a non-breaking space is required (e.g., between a number and its unit).<, >, and & must be escaped using entities.©) and numeric entities (like ©) both represent symbols. for non-breaking spaces, but rely on CSS for general layout and spacing.