← HTML Fundamentals
Semantic page layout · 15 MIN

HTML entities and special characters

HTML entities and special characters

Characters such as less-than and ampersand have special meaning in HTML syntax. Use character references when you need to display them as text. For user-generated text, escape output appropriately on the server rather than treating it as trusted markup.

Try it yourself

Change the example, run it, and explain the result in your own words. Then create one variation of your own.

Key idea

Use the example as a starting point, not something to memorize. Practise, inspect the result and make small improvements.

Code example

<p>Write &lt;h1&gt;Hello&lt;/h1&gt; as an example.</p>