Home » Free Tools » Free HTML Encoder & Decoder – Encode, Decode HTML Entities Online

Free HTML Encoder & Decoder – Encode, Decode HTML Entities Online

Free Tool · WritoryBuzz

Encode text into safe HTML entities or decode entities back into readable text. Named, decimal, and hex formats, plus attribute-safe and XSS-safe modes.

Encode / Decode HTML

Input
Output

Entity Reference (common entities)

CharacterNamedDecimalHex
Web Development

What Is HTML Encoding?

HTML encoding converts characters that have special meaning in HTML, such as less-than, greater-than, ampersand, and quotes, into entity references so browsers display them as literal text instead of interpreting them as markup. Decoding reverses the process.

This matters most when displaying user-submitted content. Without encoding, a comment containing <script> could execute as real JavaScript in every visitor's browser, a class of vulnerability called cross-site scripting (XSS). Encoding the five reserved characters, less-than, greater-than, ampersand, double quote, and single quote, neutralises that risk for plain text content.

Choosing the Right Encoding Mode

Minimal encodes only the five characters that are always unsafe in HTML text. Full also converts every non-ASCII character to a numeric entity, useful for maximum compatibility with older systems or unknown character encodings. Attribute-safe adds extra encoding needed specifically inside HTML attribute values. JS-string safe escapes characters so the text can sit safely inside a JavaScript string literal embedded in HTML.

Named vs Decimal vs Hex Entities

All three formats represent the same character. &amp; (named), &#38; (decimal), and &#x26; (hex) all render as an ampersand. Named entities are the most human-readable and are supported for common characters. Decimal and hex numeric entities work for any Unicode code point, including characters that have no named entity, which makes them the safer default for full non-ASCII encoding.


Frequently Asked Questions

What is HTML entity encoding?+
HTML entity encoding replaces characters with special meaning in HTML, like less-than and ampersand, with entity references such as &lt; and &amp;, so browsers render them as literal text rather than markup.
Why does encoding matter for security?+
Encoding user-submitted content before displaying it prevents cross-site scripting (XSS), where an attacker submits a script tag that would otherwise execute in every visitor's browser. Encoding the five reserved HTML characters neutralises this for plain text output.
What is the difference between named, decimal, and hex entities?+
They represent the same character in different notations. Named entities like &amp; are readable but only exist for common characters. Decimal (&#38;) and hex (&#x26;) numeric entities work for any Unicode character, making them the reliable choice for full encoding.
What does Smart Decode do?+
Smart Decode repeatedly decodes HTML entities until no further change occurs, which correctly resolves text that has been encoded more than once, a common issue when content passes through multiple systems that each apply their own encoding.
Copied to clipboard