Developer / 5 min read
HTML Entities Explained for Beginners
Learn why characters like <, >, &, and quotes are encoded in HTML and how to decode them for reading.
Some characters have special meaning in HTML
HTML uses characters like < and > to define tags. If you want to show those characters as text on a page, they often need to be encoded as entities.
For example, encoding helps display a code snippet without the browser interpreting it as real markup.
Common entities
You do not need to memorize every entity, but a few appear often when copying text from pages, templates, or code examples.
- < represents <.
- > represents >.
- & represents &.
- " represents a double quote.
Encoding is not sanitizing
Encoding text is useful, but it is not the same as a complete security sanitizer. If you are accepting user-generated HTML in a real app, use a trusted sanitization approach for that environment.