HTML Character Entities Encoder/Decoder
Encode text to HTML entities or decode entities back to characters. Safe-escape the 5 reserved chars, encode all non-ASCII, or decode named (&), decimal (A), and hex (A) entities. 150+ named-entity table.
HTML Reserved Character Entities
| Character | Named entity | Decimal entity |
|---|---|---|
| & | & | & |
| < | < | < |
| > | > | > |
| " | " | " |
| ' | ' | ' |
Frequently Asked Questions about the HTML Character Entities Encoder/Decoder
Which characters must I escape in HTML?
Escaping depends on context. In ordinary HTML text, ampersand and less-than need encoding when they could start a reference or tag; greater-than is usually optional. In an attribute, encode the quote that delimits the value as well. Safe handling of untrusted content requires context-specific encoding, not one universal five-character replacement.
What is the difference between named, decimal, and hex entities?
A named reference uses a label such as ©. Decimal and hexadecimal numeric references use the character's code point, such as © and ©. HTML defines thousands of named references, often with aliases. Numeric references can represent Unicode scalar values, but invalid values such as surrogate code points are replaced during parsing.
Why does ' only work in XHTML, or does it work everywhere now?
' is predefined in XML and supported in modern HTML, but it was not a named reference in HTML 4. Use ' when output must remain compatible with an HTML 4 consumer. XML and XHTML parsers support ' when the input is valid XML.
How many HTML entities are there?
HTML defines thousands of named character references, and several names can map to the same character. This calculator includes a smaller curated table and uses numeric references when no included name exists. Numeric references cover valid Unicode scalar values; surrogate code points are not valid characters.
When should I use 'Encode all' instead of 'Encode (safe)'?
Use 'Encode all' when you need maximum compatibility with consumers that cannot be trusted to handle UTF-8, such as RSS or Atom feeds read by older aggregators, plain-text email pipelines that downgrade to ASCII, legacy CMS templates, or character-set-confused log parsers. It escapes every non-ASCII character plus the reserved 5, so the output is pure 7-bit ASCII and survives any encoding-mangling step in transit. For normal modern web pages that already declare UTF-8 in their charset, 'Encode (safe)' is enough and keeps the source readable.
Related Calculators
More calculators in "Tech"
Levenshtein Distance CalculatorLuhn Checksum CalculatorHTTP Status Code LookupIP CIDR Overlap CalculatorUTF-8 Byte CounterBits to Bytes Converter
See all 98 calculators in "Tech"