MyInternships.in

HTML Basics

HTML Entities

Some characters have special meaning in HTML or cannot be typed easily. HTML entities are codes that let you display these characters safely and reliably.


What are HTML Entities?

An HTML entity is a code that represents a character. It starts with an ampersand (&) and ends with a semicolon (;). For example, < displays a less-than sign. Entities are needed for reserved characters and for symbols not on your keyboard.

The characters <, >, and & are reserved because HTML uses them for tags and entities. To show them as text, you must use their entity codes, otherwise the browser tries to interpret them as markup.

Basic Usage

Showing reserved characters
Example
<p>To write a paragraph tag, type &lt;p&gt; in your text.</p>

Common HTML Entities

CharacterEntityDescription
<&lt;Less-than sign
>&gt;Greater-than sign
&&amp;Ampersand
"&quot;Double quote
(space)&nbsp;Non-breaking space
©&copy;Copyright
®&reg;Registered trademark
&#8377;Indian Rupee sign
&rarr;Right arrow

Example: Entities in Action

Reserved characters and symbols
Example
<!DOCTYPE html>
<html>
<body>
  <p>5 &lt; 10 and 10 &gt; 5</p>
  <p>Tom &amp; Jerry</p>
  <p>&copy; 2026 MyInternships.in</p>
  <p>Price: &#8377;499 &rarr; now &#8377;299</p>
</body>
</html>

More Examples

Non-breaking space keeps words together
Example
<p>Call us at 10&nbsp;AM sharp.</p>
<p>The number 1&nbsp;000&nbsp;000 will not wrap awkwardly.</p>
Displaying code as text
Example
<p>The tag <code>&lt;a href="..."&gt;</code> creates a link.</p>
💡

A non-breaking space (&nbsp;) stops the browser from splitting two words across lines, useful for things like "10 AM" or a name and title.

⚠️

Always escape & as &amp; in your text, even inside URLs written in the page. An unescaped & followed by letters may be read as the start of an entity.

Key Takeaways

  • Entities start with & and end with ; (e.g. &copy;).
  • Use &lt;, &gt;, and &amp; for the reserved characters < > and &.
  • &nbsp; is a non-breaking space that prevents line wrapping.
  • Entities let you show symbols not found on your keyboard.

Related HTML Topics

Keep learning with these closely related tutorials.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships