Some characters have a special job in HTML. A < starts a tag and an & starts a special code, so writing them directly in your text can break the page or produce the wrong result. HTML entities are short codes such as < that display these characters safely. Entities also let you type symbols that are not on your keyboard, and the non-breaking space keeps words together on one line.
In this lesson you will learn
- Which characters must be escaped and how
- Named, decimal and hexadecimal entities
- Currency, maths and arrow symbols
- The non-breaking space and the soft hyphen
- When to type characters directly with UTF-8
You should know HTML basics.
Reserved Characters and Common Entities
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML entities</title>
<style>
body { font-family: sans-serif; margin: 12px; font-size: 15px; }
code { background: #eceff1; padding: 1px 4px; }
</style>
</head>
<body>
<!-- Characters that HTML would read as markup must be escaped -->
<p>Use <code><p></code> for a paragraph.</p>
<p>Tom & Jerry, 5 < 8 and 9 > 2</p>
<p title="She said "hello"">Hover me: the title contains quotes.</p>
<!-- Named, decimal and hexadecimal forms of the same kind of thing -->
<p>© 2026 Core Tech ED · ® · ™</p>
<p>Price: ৳500 (taka), €5, £4, ₹450 (rupee)</p>
<!-- A non-breaking space keeps "10" and "km" on the same line -->
<p>Distance: 10 km. Temperature: 30 °C.</p>
</body>
</html>
Result
- An entity starts with
&and ends with;.<shows<and>shows>, which is how you write about tags without the browser treating them as tags. &shows an ampersand. Always escape it in text and in URLs inside attributes, for examplehref="page?a=1&b=2"."shows a double quote inside an attribute value that is itself wrapped in double quotes.- There are three ways to write a character: a name (
©), a decimal number (৳, the Bangladeshi taka sign) or a hexadecimal number (₹, the Indian rupee sign). Every Unicode character has a number, but only some have names. is a non-breaking space. It looks like a normal space, but the line never breaks there, so “10 km” and “30 °C” always stay together.
Symbols and UTF-8
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Symbols and UTF-8</title>
<style>
body { font-family: sans-serif; margin: 12px; font-size: 15px; }
td { padding: 3px 12px 3px 0; }
.narrow { width: 110px; border: 1px solid #b0bec5; padding: 4px; }
</style>
</head>
<body>
<table>
<tr><td>Maths</td><td>× ÷ ± ≠ ≤ ≥ ½ x²</td></tr>
<tr><td>Arrows</td><td>← ↑ → ↓ ↔</td></tr>
<tr><td>Punctuation</td><td>– — … «quote»</td></tr>
<tr><td>Typed directly (UTF-8)</td><td>× ÷ → ৳ বাংলা 😀</td></tr>
</table>
<!-- ­ is a soft hyphen: the word breaks there only if it must -->
<p class="narrow">Internationali­zation and accessi­bility matter.</p>
</body>
</html>
Result
- Entities exist for maths (
×,≤,½), arrows (→) and typography (—,…). - With
<meta charset="UTF-8">at the top of the page, you can also type any character directly: symbols, Bangla script and emoji all work. This is easier to read in the source, and modern editors save files as UTF-8 by default. ­is a soft hyphen: an invisible break point. In the narrow box, “Internationalization” breaks at the soft hyphen and shows a hyphen; in a wide box it stays whole.- You still need entities for
<,>and&in text, and for characters that are invisible or easy to confuse, such as the non-breaking space.
Most Used HTML Entities
| Character | Named | Number | Description |
|---|---|---|---|
| < | < | < | Less than |
| > | > | > | Greater than |
| & | & | & | Ampersand |
| “ | " | " | Double quote |
| ‘ | ' | ' | Apostrophe |
| (space) | |   | Non-breaking space |
| © | © | © | Copyright |
| € | € | € | Euro |
| ৳ | none | ৳ | Taka |
| × | × | × | Multiplication |
| → | → | → | Right arrow |
Common Mistakes
- Forgetting the semicolon, as in
© 2026. Some old entities still work without it, but many do not. - Using many
in a row for spacing. Use CSSmargin,paddingorgapinstead. - Leaving out
<meta charset="UTF-8">, so typed symbols turn into strange characters such as “é”. - Writing a raw
<in example code, which the browser may read as the start of a tag.
Practice Exercises
Exercise 1. Write HTML that displays exactly: if (a < b && c > d)
Show answer
<code>if (a < b && c > d)</code>
Exercise 2. Write a footer line “© 2026 My Site”, keeping “My Site” from breaking across two lines.
Show answer
<footer>© 2026 My Site</footer>
Frequently Asked Questions
Should I use entities or type characters directly?
With UTF-8, typing characters directly is fine and easier to read. Use entities for the reserved characters (<, >, &, quotes in attributes) and for invisible ones such as .
How do I find the number for a character?
Look it up in a Unicode chart or a character map tool. Its code point, such as U+09F3 for the taka sign, gives the hexadecimal entity ৳, which is the same character as ৳.
Summary
- Escape
<,>and&as<,>and&. - Entities can be named, decimal or hexadecimal.
prevents a line break;­allows one with a hyphen.- With UTF-8, most symbols can be typed directly.
