← Imperial Products / Tools / HTML Entities

HTML Entity Encoder / Decoder

Convert special characters to HTML entities and back. Supports named entities, decimal numeric entities, and hex numeric entities. Runs entirely in your browser — nothing is uploaded.

|
Encode mode: Type or paste text on the left — HTML entities appear on the right in real time. Choose Special chars only to encode just & < > " ', or All characters for a fully encoded representation.
Input — plain text
0 chars 0 lines
Output — HTML entities
0 chars 0 lines

Common HTML Entity Reference

Click any row to insert that entity into the input field.

Char Description Named Entity Decimal Hex Use

What Are HTML Entities?

HTML entities are special text strings that represent characters which would otherwise be interpreted as HTML markup or are difficult to type directly. An entity begins with an ampersand (&) and ends with a semicolon (;). For example, the less-than sign (<) is written as &lt; so the browser displays it as a character instead of treating it as the start of an HTML tag.

Why Encode HTML Entities?

Types of HTML Entities

There are three ways to write an HTML entity:

Special Characters Only vs. All Characters

Special characters only encodes the five characters that have special meaning in HTML: &, <, >, ", and '. This is the correct approach for HTML escaping in most web development scenarios — it produces readable output while preventing markup injection.

All characters encodes every character that has a named entity (such as accented letters, currency symbols, and mathematical operators) and represents any remaining non-ASCII characters as numeric entities. Use this mode when you need a fully ASCII-safe representation of text, for example in legacy systems or certain email clients.

How to Decode HTML Entities

Decoding converts entity strings back to their original characters. This tool handles all three entity forms: named (&amp;), decimal (&#38;), and hex (&#x26;). Use decode mode to inspect HTML source code or to extract plain text from HTML-encoded content.

Security Note

Always encode user-supplied content before inserting it into an HTML page. Even if a string looks harmless, failing to encode < and & can allow script injection. This tool is useful for manual inspection; in production code use your framework's built-in escaping functions.

More Free Developer Tools