Back to All Tools

HTML Entity Encode / Decode

Convert special characters to HTML entities and back. Supports named, numeric, and full encoding modes — all processed locally in your browser.

Output will appear here…

What are HTML entities?

HTML entities are special text codes that represent characters that have a reserved meaning in HTML, or characters that are difficult to type. For example, & (ampersand) must be written as & in HTML source to avoid being misinterpreted as the start of an entity.

Named vs numeric entities

  • Named entities — human-readable shorthand, e.g. &, ©, €. Not all characters have named forms.
  • Numeric decimal — works for any Unicode character, e.g. © for ©.
  • Numeric hex — same as decimal but base-16, e.g. © for ©.

The 5 essential HTML characters to escape

Always escape these characters when inserting user-controlled text into HTML to prevent Cross-Site Scripting (XSS) attacks:

  • & &
  • < &lt;
  • > &gt;
  • " &quot;
  • ' &apos;

When should you encode HTML entities?

  • Inserting user-generated content into HTML to prevent XSS.
  • Displaying source code inside <pre> or <code> blocks.
  • Embedding special characters (©, ™, €) in HTML templates for maximum compatibility.
  • Creating email templates where special characters may be mangled by email clients.