HTML Decode
Turn HTML entities back into the characters they stand for. Paste encoded HTML and the readable text updates instantly in your browser.
0 characters
0 characters
About HTML Decode
This tool performs standards-compliant HTML decoding, converting HTML entities[5] back into their original, human-readable characters. This process is the inverse of HTML encoding, which is necessary to display special characters within an HTML document without them being misinterpreted as markup. HTML entities are broadly categorized into named character references[7] (e.g., `&`) and numeric character references[9] (NCRs). NCRs specify a character's code point directly, either in decimal (`€`) or hexadecimal (`€`) format, while named entities provide mnemonic aliases. The parsing and decoding of these entities are formally defined by the WHATWG[18] in the HTML Living Standard[16], which this tool strictly follows for maximum accuracy.
The numbers within NCRs correspond to code points[2] in the Unicode[14] Character Standard, a universal encoding system maintained by the Unicode Consortium[15]. For example, the entity `©` directly references the Unicode code point U+00A9, which represents the copyright symbol (Β©). The HTML decoder's fundamental task is to parse these entity strings, look up the corresponding Unicode code point from the standard's defined mapping, and replace the entity with the actual character it represents, typically rendered using a UTF-8[13] or UTF-16[12] encoding in modern systems.
The entity mechanism was inherited from SGML[11], the metalanguage from which HTML originated. Early specifications like the W3C[20]'s HTML 4.01[20] defined a fixed set of 252 named entities. With the advent of HTML5[6], the WHATWG[18] significantly expanded this list to include thousands of entities, incorporating characters from MathML[8] and other domains to support complex mathematical and scientific notation directly in HTML. A compliant modern decoder must therefore recognize this vastly larger set of named character references[17].
From a security perspective, HTML encoding is a primary defense against Cross-Site Scripting (XSS)[3] attacks by neutralizing characters like `<` and `>` that could be interpreted as part of an HTML element[4]. This decoding tool is invaluable for developers and security analysts to inspect the original, pre-encoded data. It allows for the analysis of user-submitted content, debugging of data transmission issues, and examination of potential XSS payloads that have been obfuscated through encoding. It is critical to recognize that decoding untrusted data and rendering it into a document without proper sanitization can re-introduce the very security vulnerabilities that encoding is meant to prevent.
How to Use
- Paste your HTML-encoded string into the input text area.
- The tool automatically performs the decoding process in real time upon input.
- The decoded, human-readable text appears instantly in the output area below.
- Review the output to see the original characters restored from their entity representations.
- Click the "Copy" button to transfer the decoded text to your clipboard.
- Use the "Clear" button to reset both the input and output fields for a new operation.
Frequently Asked Questions
What is the difference between HTML decoding and URL decoding?
HTML decoding converts entities like `<` and `<` into characters like `<`. URL decoding[10], or percent-decoding, converts percent-encoded octets like `%3C` into characters like `<`. They are used in different contexts: HTML for document content and URLs for resource identifiers.
Why are there both decimal and hexadecimal numeric references?
Both `...;` (decimal) and `...;` (hexadecimal) reference Unicode[14] code points. The choice is often a matter of developer preference or system convention. Hexadecimal notation is common in programming contexts as it aligns more closely with how character sets are often documented.
Does this tool handle all named entities?
Yes, this decoder supports the complete set of named character references defined in the HTML Living Standard[17], including legacy entities from HTML 4.01[20] and the extended set from HTML5.
Is it safe to use the output of this tool directly in my HTML?
No, not if the source is untrusted. Decoding user-provided content and rendering it as HTML can create a Cross-Site Scripting (XSS)[3] vulnerability. This tool is for inspection and analysis, not for sanitization. Always re-encode or sanitize data before rendering it in a web page.
What happens if I input an invalid or non-existent entity?
Following the WHATWG[18] parsing standard, an invalid or unterminated entity (e.g., `¬anentity;`) is passed through as literal text. The decoder will leave the original string unchanged, allowing you to see the malformed entity in context.
What character encoding does the output use?
The decoded output consists of Unicode[14] characters. In the browser's JavaScript engine, these are represented as UTF-16[12]. When you copy the text, your operating system will typically place it on the clipboard using a common encoding like UTF-8[13].
What is the purpose of the `&`, `<`, and `>` entities?
These are the most fundamental entities required for HTML. `&` (ampersand) is the escape character that begins an entity definition, so it must be encoded to appear as a literal character. `<` (less-than) and `>` (greater-than) are used to represent the `<` and `>` characters without them being interpreted as the start or end of an HTML tag[4].
Where are HTML named entities officially defined?
The canonical definition is maintained by the WHATWG[18] as a JSON resource that accompanies the HTML Living Standard[17]. This file provides the definitive mapping of named entities to their corresponding Unicode character sequences.
Sources (20)
- Wikipedia: Character encoding
- Wikipedia: Code point
- Wikipedia: Cross-site scripting (XSS)
- Wikipedia: HTML element
- Wikipedia: HTML entity
- Wikipedia: HTML5
- Wikipedia: List of XML and HTML character entity references
- Wikipedia: MathML
- Wikipedia: Numeric Character References
- Wikipedia: Percent-encoding
- Wikipedia: SGML
- Wikipedia: UTF-16
- Wikipedia: UTF-8
- Wikipedia: Unicode
- The Unicode Consortium
- WHATWG: HTML Living Standard
- WHATWG: HTML Named Character References
- WHATWG (Web Hypertext Application Technology Working Group)
- W3C (World Wide Web Consortium)
- W3C: HTML 4.01 Specification
About Matt George
I'm Matt George, a software engineer in the startup space. I run my own shop building software for early-stage founders, and I love making free tools and experiences that people actually use. Enjoy using HTML Decode!