Master HTML From Scratch

Clear, interactive, and structured HTML lessons designed for beginners.

HTML Special Characters

Learn how to display reserved characters, symbols, spaces, currency signs, and other special characters correctly in HTML.

What are HTML Special Characters?

Some characters have a special meaning in HTML. For example, the less-than sign < is used to begin an HTML tag.

When you need to display such characters as normal text, HTML character references can be used.

Example: To display: < in normal page text, you can write: &lt;

HTML Character References

Special characters can be represented using character references. A character reference commonly starts with & and ends with ;.

&lt;
&gt;
&amp;
&quot;
&copy;

The browser interprets these references and displays the corresponding characters.

Less Than Symbol

The less-than symbol is written as:

&lt;
<

Example

<p>
    5 &lt; 10
</p>

5 < 10

Greater Than Symbol

The greater-than symbol can be written as:

&gt;
>

Example

<p>
    10 &gt; 5
</p>

10 > 5

Ampersand Symbol

The ampersand symbol is represented using:

&amp;
&

Quotation Mark

The double quotation mark can be represented using:

&quot;
"

Example

<p>
    He said &quot;Hello&quot;.
</p>

He said "Hello".

Non-Breaking Space

The &nbsp; character reference represents a non-breaking space.

&nbsp;

It creates a space that the browser does not normally collapse with adjacent spaces and keeps the words together across a line break.

Example

<p>
    CIIT&nbsp;Institute
</p>

CIIT Institute

Copyright Symbol

&copy;
©

Example

<p>
    &copy; CIIT Institute
</p>

© CIIT Institute

Registered Trademark Symbol

&reg;
®

Example

<p>
    CIIT&reg;
</p>

CIIT®

Trademark Symbol

&trade;
™

Example

<p>
    CIIT&trade;
</p>

CIIT™

Currency Symbols

HTML can display a wide range of currency symbols using character references or Unicode characters.

Symbol Reference Output
Rupee &#8377; ₹
Dollar &dollar; $
Euro &euro; €
Pound &pound; £
Yen &yen; ¥

Mathematical Symbols

Symbol Reference Output
Less Than &lt; <
Greater Than &gt; >
Plus/Minus &plusmn; ±
Multiplication &times; ×
Division &divide; ÷
Not Equal &ne; ≠
Less Than or Equal &le; ≤
Greater Than or Equal &ge; ≥

Arrow Symbols

Symbol Reference Output
Left Arrow &larr; ←
Right Arrow &rarr; →
Up Arrow &uarr; ↑
Down Arrow &darr; ↓
Left-Right Arrow &harr; ↔

Other Common Special Characters

Character Reference Result
Cent &cent; ¢
Section &sect; §
Degree &deg; °
Paragraph &para;
Bullet &bull; •
Middle Dot &middot; ·

Numeric Character References

Characters can also be represented using numeric character references.

&#169;
&#174;
&#8377;

© Copyright

® Registered

₹ Indian Rupee

Hexadecimal Character References

Unicode characters can also be represented using hexadecimal numeric references.

&#x20AC;

€

The example above represents the Euro symbol.

Example in an HTML Page

<!DOCTYPE html>

<html>

<head>

    <title>
        Special Characters
    </title>

</head>

<body>

    <p>
        5 &lt; 10
    </p>

    <p>
        CIIT &copy; Institute
    </p>

    <p>
        Price: &#8377;4500
    </p>

    <p>
        HTML &rarr; CSS &rarr; JavaScript
    </p>

</body>

</html>

Output

5 < 10

CIIT © Institute

Price: ₹4500

HTML → CSS → JavaScript

Important Rules

  • Character references normally begin with &.
  • Named references usually end with ;.
  • Use character references when a character could be interpreted as HTML markup.
  • Numeric character references can represent Unicode characters.
  • Always choose the correct character reference for the character you want to display.

Common Mistakes

  • Writing < directly when it should be interpreted as text.
  • Forgetting the semicolon at the end of a named character reference.
  • Using an incorrect character reference.
  • Confusing HTML character references with CSS escape sequences or programming-language escapes.

Practice Exercise

  1. Display < and > as normal text.
  2. Display an ampersand using &amp;.
  3. Display a copyright symbol.
  4. Display the Indian Rupee symbol.
  5. Display a right arrow.
  6. Create a small HTML page containing at least five different special characters.

Summary

HTML character references are used to display special characters and symbols safely in HTML. Common examples include &lt;, &gt;, &amp;, &copy;, &reg;, and &nbsp;. Numeric and hexadecimal references can also be used to represent Unicode characters.