HTML Decoder
Decode HTML entities back to their original characters for editing or processing.
HTML Encoded Input
Decoded Output
Input Length
55
Output Length
45
Supported Entity Types
Named Entities: &, <, >, ", Ā , etc.
Decimal Entities: A (for A), Ć© (for e with accent), etc.
Hexadecimal Entities: A (for A), Ć© (for e with accent), etc.
Use Case: Decode HTML entities when you need to edit HTML content that was previously encoded for safe display, or when processing scraped web content.
What Is HTML Decoding?
HTML decoding is the process of converting HTML character entities back into their original, human-readable characters. When text is published on the web, certain characters must be encoded so that browsers do not confuse them with HTML markup. An ampersand becomes &, a less-than sign becomes <, and a double quote becomes ". An HTML decoder reverses this transformation, restoring the raw characters so you can read, edit, or process the content without interference from entity syntax.
HTML entity encoding was standardized in HTML 2.0 and has been refined in every subsequent version of the specification. The HTML5 standard published by the W3C defines over two thousand named character references, covering everything from basic punctuation to mathematical symbols and emoji. When you paste encoded text into this HTML decoder, the tool uses the browser's native parsing engine to resolve every entity reference ā named, decimal, or hexadecimal ā to its correct Unicode code point.
Everyday situations where you need an HTML decoder include: copying code snippets from a CMS that auto-escapes output, processing web-scraped data stored in a database with escaped characters, debugging API responses that return HTML-encoded JSON fields, converting template strings exported from email marketing platforms, and proofreading content that was accidentally double-encoded. The decoder handles all of these cases in one step.
The distinction between decoding and rendering is important. A browser renders HTML ā it interprets tags and displays visual output. An HTML decoder only resolves character entities; it does not strip or execute any tags. That means <script> decodes to the literal text <script>, not to a script element. This makes the decoder safe and predictable for text-processing workflows.
How the HTML Decoder Works
This HTML decoder uses the browser's own DOM parser ā the same engine that renders every web page ā to resolve entities accurately. The algorithm assigns the encoded input to the innerHTML property of a temporary, detached <textarea> element, then reads back the value property. Because the browser performs entity resolution as part of parsing innerHTML, the value property always contains the fully decoded Unicode string. No regular expressions, no custom lookup tables ā just the canonical browser implementation.
For server-side rendering (SSR) environments where no DOM is available, the decoder falls back to a deterministic string-replacement routine. It processes the seven most common named entities in a single pass, then applies two regular-expression substitutions: one for decimal numeric references (&#NNN;) and one for hexadecimal numeric references (&#xHHH;). Both substitutions call String.fromCharCode() to map the code point to its Unicode character.
The tool also reports the character length of the input and the decoded output. Because entities like & (five characters) decode to a single ampersand, the output length is almost always shorter than the input length, and the difference gives you a quick sense of how heavily encoded the original string was.
Entity Resolution Rules
Where:
- NNN= Decimal Unicode code point (e.g. 65 for the letter A)
- HHH= Hexadecimal Unicode code point (e.g. 41 for the letter A)
- String.fromCharCode()= JavaScript built-in that converts a numeric code point to its Unicode character
Types of HTML Entities Supported
The HTML decoder handles all three categories of HTML character references defined in the HTML5 specification.
Named Character References
Named entities are mnemonic shortcuts for frequently used characters. They begin with an ampersand, contain a descriptive name, and end with a semicolon. The HTML5 specification defines over two thousand named references. The most commonly encountered ones in everyday content are listed below.
| Entity | Character | Description |
|---|---|---|
| & | & | Ampersand |
| < | < | Less-than sign |
| > | > | Greater-than sign |
| " | " | Double quotation mark |
| ' | ' | Apostrophe / single quote |
| | (space) | Non-breaking space |
| © | Ā© | Copyright symbol |
| ® | Ā® | Registered trademark symbol |
| € | ⬠| Euro sign |
Decimal Numeric References
Any Unicode character can be referenced by its decimal code point using the syntax &#NNN;. For example, A resolves to the letter A because 65 is the Unicode code point for uppercase A. Decimal references are universal ā they work for every character in the Unicode standard, including characters for which no named entity exists.
Hexadecimal Numeric References
Hexadecimal references follow the syntax &#xHHH; where HHH is the code point expressed in base 16. The letter x (or X) signals hexadecimal notation. For example, A also resolves to A because hex 41 equals decimal 65. Hex references are common in XML-derived formats and are the preferred notation in many code generators because code points in Unicode documentation are conventionally written in hex (e.g. U+0041).
Common Use Cases for an HTML Decoder
Understanding where HTML encoding appears in real workflows helps you get the most out of this decoder tool.
CMS and Blog Platforms
Content management systems like WordPress, Drupal, and many headless CMS platforms automatically escape special characters when storing or displaying content. When you export posts via REST API or XML feed, the body fields often contain fully encoded HTML. Running that output through the HTML decoder gives you clean, readable source text that you can re-import, convert to Markdown, or feed into a language model without noisy entity clutter.
Web Scraping and Data Pipelines
Scraped HTML pages store display text as encoded entities. A product name like AT&T appears in the raw source as AT&T. Database columns populated by scrapers frequently contain these entities verbatim, causing downstream sorting, matching, and search operations to behave incorrectly. Decoding each text field before storage or analysis fixes these subtle data-quality issues.
Email Templates and Marketing Copy
Email service providers (ESPs) encode HTML entities in exported templates to ensure compatibility across email clients. When you pull a template out of an ESP and want to edit or repurpose it, pasting the encoded HTML into this decoder lets you work with the clean source immediately rather than manually hunting for entity sequences.
API Response Debugging
Some REST and GraphQL APIs return strings with HTML entities already embedded ā particularly APIs that bridge legacy server-side systems. A response like {"title": "Q&A Section"} is difficult to read at a glance. Pasting the string into the decoder instantly shows you what the end-user-facing text actually says, making debugging faster.
Double-Encoding Diagnosis
Double-encoding happens when an already-encoded string passes through another encoding step, turning & into &amp;. Pasting double-encoded text into the decoder a first time gives you the single-encoded form, and a second pass restores the original character. This is a quick way to confirm whether your pipeline is encoding data more than once.
HTML Decoding vs HTML Encoding
HTML decoding and HTML encoding are inverse operations. Encoding converts raw characters into safe entity sequences for embedding in HTML documents ā it protects against cross-site scripting (XSS) by ensuring that user-supplied text cannot be interpreted as markup. Decoding reverses that transformation to recover the original characters for processing, editing, or display in a non-HTML context.
The right operation depends entirely on your context. Use encoding when you are placing text into an HTML page or template and you want the browser to display it as literal characters rather than parse it as tags. Use decoding when you are extracting text from an HTML page or encoded string and you need to work with the underlying characters. Never decode user input on its way into a database or template ā that would undo the security protection that encoding provides. Only decode at the final consumption point where you control how the string is used.
A quick way to tell which direction you need: if the string you are looking at contains sequences like &, <, or &#NNN;, the text is encoded and this HTML decoder will restore the originals. If the string contains raw angle brackets and ampersands that you need to safely embed in HTML, use an HTML encoder instead.
Worked Examples
Decode a Basic HTML Snippet
Problem:
A CMS API returns: <div class="container">Hello & welcome!</div>. What is the decoded output?
Solution Steps:
- 1Identify the named entities: &lt; = <, &gt; = >, &quot; = ", &amp; = &
- 2Replace &lt; with <, &gt; with >, &quot; with "
- 3Replace &amp; with &
- 4Reconstruct the string with all entities resolved
Result:
<div class="container">Hello & welcome!</div>
Decode Decimal Numeric Entities
Problem:
A database field contains: Hell&var(--foreground); W&var(--foreground);rld. What characters do these code points map to?
Solution Steps:
- 1Each &#NNN; entity maps to a Unicode character via String.fromCharCode(NNN)
- 2H ā fromCharCode(72) = H, e ā fromCharCode(101) = e, l ā fromCharCode(108) = l (Ć2), &var(--foreground); ā fromCharCode(111) = o
- 3  ā fromCharCode(32) = space, W ā fromCharCode(87) = W, &var(--foreground); ā o, r ā fromCharCode(114) = r, l ā l, d ā fromCharCode(100) = d
- 4Concatenate all resolved characters in order
Result:
Hello World
Decode Hexadecimal Numeric Entities
Problem:
A scraped page contains the copyright line: &#xA9; 2024 Acme Corp. Decode the hex entity.
Solution Steps:
- 1The entity © uses the hexadecimal syntax &#xHHH;
- 2Parse the hex string 'A9' as base-16: parseInt('A9', 16) = 169
- 3Apply String.fromCharCode(169) to get the Unicode character at code point 169
- 4Code point 169 is the copyright sign Ā©
Result:
Ā© 2024 Acme Corp
Diagnose Double-Encoded Text
Problem:
An exported XML feed contains: AT&amp;T. Why does it look wrong, and what is the decoded result?
Solution Steps:
- 1AT&amp;T is a double-encoded string: the original & was first encoded to &amp;, then the & in &amp; was encoded again to &amp;amp;
- 2First decoding pass: &amp; resolves to &, giving AT&T
- 3Second decoding pass: & resolves to &, giving AT&T
- 4One pass through the decoder converts &amp;T to &T; a second pass gives the final AT&T
Result:
AT&T (after two decoding passes)
Tips & Best Practices
- āPaste the entire block of encoded text at once ā the decoder handles mixed named, decimal, and hex entities in a single pass.
- āIf your output still looks encoded, the input may be double-encoded. Run it through the decoder a second time to resolve the remaining entities.
- āUse the output character count displayed below the result to confirm that all entities were resolved (encoded text is always longer than decoded text).
- āAfter decoding web-scraped content, check for non-breaking spaces (&nbsp;) that may cause unexpected whitespace in downstream processing.
- āWhen debugging API responses, isolate just the string value (without surrounding JSON quotes) before pasting it into the decoder.
- āFor email template editing, decode the full exported HTML, make your edits, then re-encode before importing back into your email service provider.
- āThe decoder does not strip HTML tags ā use a separate HTML-to-text tool if you also need to remove markup after decoding entities.
- āHexadecimal entities use the prefix &#x (or &#X) ā if your string contains both decimal and hex entities, the decoder resolves them all correctly in one pass.
Frequently Asked Questions
Sources & References
Last updated: 2026-06-05
Help us improve!
How would you rate the HTML Decoder?
Editorial Note
MyCalcBuddy Editorial Team
This page is maintained as an educational calculator reference.
Formula Source: Standard Mathematical References
by Various