HTML Entity Encoder/Decoder

    Encode and decode HTML entities safely

    Instant Convert

    Encode or decode with one click

    100% Private

    Runs entirely in your browser

    No Signup

    Free tool, no registration required

    What Are HTML Entities?

    HTML entities are special text sequences used to represent characters that have reserved meaning in HTML markup or that cannot be typed directly. An entity begins with an ampersand (&) and ends with a semicolon (;). The characters < and > are the most critical examples — if you include a literal less-than sign in HTML, the browser tries to parse it as a tag. Writing &lt; tells the browser to display the character without interpreting it as markup.

    Common Use Cases

    Encoding user-supplied content before inserting it into HTML is the primary defense against Cross-Site Scripting (XSS) attacks — a script tag in a comment field becomes harmless once its angle brackets are replaced with &lt; and &gt;. Technical documentation and code examples use entities to display markup literally rather than having the browser render it. Copyright notices, trademark symbols, currency signs, and typographic punctuation like em-dashes (&mdash;) are all expressed as named entities to ensure consistent display across character encodings.

    How to Use This Tool

    Switch to "Encode" mode and paste your HTML or text containing special characters — the tool converts reserved characters and common symbols into their entity equivalents. Switch to "Decode" to do the reverse: turn entity sequences back into readable text. Click Swap to feed the result back in with the mode reversed. The tool handles named entities (&copy;), decimal numeric entities (&#169;), and hexadecimal entities (&#xA9;) on the decode side.

    Technical Notes

    Named entities are defined in the HTML specification and cover hundreds of characters. Numeric entities (&#N;) reference the Unicode code point directly, while hex entities (&#xN;) do the same in hexadecimal — both are portable across all HTML versions. Attributes and content have slightly different escaping rules: attribute values also need &quot; for double quotes when the value is double-quoted. Processing runs entirely in the browser — no data is sent to any server.

    Frequently Asked Questions