HTML Entity Encoder

Encode special characters to HTML entities and decode them back instantly

Common HTML Entities Reference

CharNamedNumericHexDescription

Frequently Asked Questions

What are HTML entities? +
HTML entities are special codes used to represent characters that have special meaning in HTML, like angle brackets and ampersands, or characters that are not easily typed on a keyboard. They start with an ampersand (&) and end with a semicolon (;), like & for the ampersand character.
Why do I need to encode HTML entities? +
Encoding HTML entities prevents browsers from misinterpreting special characters as HTML markup. For example, if you want to display a less-than sign (<) on a web page, you must write &lt; — otherwise the browser may treat it as the start of an HTML tag. This also helps prevent cross-site scripting (XSS) attacks.
What is the difference between named and numeric HTML entities? +
Named entities use a descriptive word (like &amp; for ampersand or &copy; for copyright), while numeric entities use the character's Unicode code point (like &#38; or &#x26; for ampersand). Both produce the same result, but named entities are more readable while numeric entities cover every Unicode character.
Which characters must be encoded in HTML? +
At minimum, you must encode: ampersand (& as &amp;), less-than (< as &lt;), greater-than (> as &gt;), and double-quote (" as &quot;) when inside attribute values. Encoding single quotes (' as &#39; or &apos;) is also recommended for security.
Can I use HTML entities in CSS or JavaScript? +
HTML entities only work inside HTML markup. In CSS, you use Unicode escape sequences (like \00A9 for copyright). In JavaScript strings, you use Unicode escapes (like \u00A9) or include the character directly. This tool is designed specifically for HTML context encoding and decoding.
Copied!