HTML Entities Explained — When and How to Use Them

Learn what HTML entities are, why they exist, and how to encode or decode them online.

Some characters have special meaning in HTML — like <, >, and &. To display them as text, you use HTML entities. This guide covers the most common ones and how to work with them.

1. What are HTML entities?

An HTML entity is a sequence of characters that represents another character. They start with & and end with ;. For example, &amp; displays as &, and &lt; displays as <.

2. Common entities you should know

  • &amp; — ampersand (&)
  • &lt; — less than (<)
  • &gt; — greater than (>)
  • &quot; — double quote (")
  • &apos; — apostrophe (')
  • &nbsp; — non-breaking space
  • &copy; — copyright symbol (©)
  • &reg; — registered symbol (®)

3. Why use them?

If you write <script> in HTML, the browser tries to interpret it as a tag. Wrapping it in entities — &lt;script&gt; — makes it display as text. This is essential for displaying code snippets on a webpage.

4. How to encode or decode

Open the HTML Encoder or HTML Decoder, paste your text, and click Encode or Decode. This is useful when posting code examples in blog comments or CMS fields that strip raw HTML.

Advertisement