Skip to main content
D
HTML
HTML Entities

HTML Entities

HTML entities safely display reserved characters.

Read Time
5 min read
Difficulty
Beginner
Last Updated
Jun 15, 2026
Version
v1.0.0

Introduction

HTML reserves specific characters like angle brackets for tags. If you type a less-than sign, the browser expects an HTML element. Entities use special codes to render these characters safely on the screen.

Syntax

Syntax
1<!-- entity syntax -->
2<p>5 &lt; 10</p>

Example

Example
1<!-- this uses entities -->
2<!DOCTYPE html>
3<html lang="en">
4  <head>
5    <meta charset="UTF-8">
6    <meta name="viewport" content="width=device-width, initial-scale=1.0">
7    <title>Entities</title>
8  </head>
9  <body>
10    <p>The &lt;h1&gt; tag creates a heading.</p>
11  </body>
12</html>

Try it Yourself

Hands-on Practice
Modify the code below to see how it affects the output. This is the best way to learn!
Interactive Editor
1234567891011121314151617181920
Live Preview

Key Points

  • Entities display reserved HTML characters.
  • An entity begins with an ampersand.
  • An entity ends with a semicolon.
  • Non-breaking spaces prevent line breaks.

Up Next

Continue your journey with the next topic.

Go to HTML Symbols