HTML Decoder

Decode HTML entities back to their original characters for editing or processing.

HTML Encoded Input

Decoded Output

<div class="container">Hello & welcome!</div>

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 &amp;, a less-than sign becomes &lt;, and a double quote becomes &quot;. 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 &lt;script&gt; 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 &amp; (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

&#NNN; → String.fromCharCode(NNN) | &#xHHH; → String.fromCharCode(parseInt(HHH, 16))

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
&amp;&Ampersand
&lt;<Less-than sign
&gt;>Greater-than sign
&quot;"Double quotation mark
&apos;'Apostrophe / single quote
&nbsp;(space)Non-breaking space
&copy;©Copyright symbol
&reg;®Registered trademark symbol
&euro;€Euro sign

Decimal Numeric References

Any Unicode character can be referenced by its decimal code point using the syntax &#NNN;. For example, &#65; 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, &#x41; 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&amp;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&amp;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 &amp; into &amp;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 &amp;, &lt;, 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: &lt;div class=&quot;container&quot;&gt;Hello &amp; welcome!&lt;/div&gt;. What is the decoded output?

Solution Steps:

  1. 1Identify the named entities: &amp;lt; = <, &amp;gt; = >, &amp;quot; = ", &amp;amp; = &
  2. 2Replace &amp;lt; with <, &amp;gt; with >, &amp;quot; with "
  3. 3Replace &amp;amp; with &
  4. 4Reconstruct the string with all entities resolved

Result:

<div class="container">Hello & welcome!</div>

Decode Decimal Numeric Entities

Problem:

A database field contains: &#72;&#101;&#108;&#108;&var(--foreground);&#32;&#87;&var(--foreground);&#114;&#108;&#100;. What characters do these code points map to?

Solution Steps:

  1. 1Each &#NNN; entity maps to a Unicode character via String.fromCharCode(NNN)
  2. 2&#72; → fromCharCode(72) = H, &#101; → fromCharCode(101) = e, &#108; → fromCharCode(108) = l (Ɨ2), &var(--foreground); → fromCharCode(111) = o
  3. 3&#32; → fromCharCode(32) = space, &#87; → fromCharCode(87) = W, &var(--foreground); → o, &#114; → fromCharCode(114) = r, &#108; → l, &#100; → fromCharCode(100) = d
  4. 4Concatenate all resolved characters in order

Result:

Hello World

Decode Hexadecimal Numeric Entities

Problem:

A scraped page contains the copyright line: &amp;#xA9; 2024 Acme Corp. Decode the hex entity.

Solution Steps:

  1. 1The entity &#xA9; uses the hexadecimal syntax &#xHHH;
  2. 2Parse the hex string 'A9' as base-16: parseInt('A9', 16) = 169
  3. 3Apply String.fromCharCode(169) to get the Unicode character at code point 169
  4. 4Code point 169 is the copyright sign Ā©

Result:

Ā© 2024 Acme Corp

Diagnose Double-Encoded Text

Problem:

An exported XML feed contains: AT&amp;amp;T. Why does it look wrong, and what is the decoded result?

Solution Steps:

  1. 1AT&amp;amp;T is a double-encoded string: the original & was first encoded to &amp;amp;, then the & in &amp;amp; was encoded again to &amp;amp;amp;
  2. 2First decoding pass: &amp;amp; resolves to &amp;, giving AT&amp;T
  3. 3Second decoding pass: &amp; resolves to &, giving AT&T
  4. 4One pass through the decoder converts &amp;amp;T to &amp;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 (&amp;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 &amp;#x (or &amp;#X) — if your string contains both decimal and hex entities, the decoder resolves them all correctly in one pass.

Frequently Asked Questions

Yes. The decoder resolves character entities but does not execute or render any HTML tags. Pasting a string containing &lt;script&gt; tags decodes those entities to literal angle brackets and text — it does not run any JavaScript. The output is plain decoded text, so you can safely use this tool to inspect content from any source without security risk.
HTML entities are multi-character sequences that represent a single character. For example, &amp;amp; is five characters long but decodes to a single ampersand. Every entity in your input shrinks the character count during decoding. The ratio of input length to output length gives you an approximate measure of how heavily the string was encoded.
Named entities use mnemonic names like &amp;amp; or &amp;copy; and are defined by the HTML specification. Numeric entities — either decimal (&amp;#NNN;) or hexadecimal (&amp;#xHHH;) — reference a character by its Unicode code point number. Both types decode to the same characters; numeric entities just offer coverage of every Unicode code point, not only those with assigned names.
Yes. Simply paste the JSON value (or the entire JSON payload) into the input field and the decoder will resolve all HTML entities it finds. Be aware that JSON itself uses backslash escaping (e.g. \n for newline) which is separate from HTML entity encoding — the decoder only handles HTML entities, not JSON escape sequences.
The browser's native textarea-based decoder correctly handles supplementary Unicode characters, including emoji and rare CJK ideographs, as long as they are encoded as numeric HTML entities. For example, &#x1F600; decodes to the grinning face emoji šŸ˜€. JavaScript's String.fromCharCode() handles characters up to U+FFFF; surrogate pair handling for higher code points is managed by the browser's built-in parser in the primary decoding path.
HTML decoding resolves HTML entity references such as &amp;amp; and &amp;#65;. URL decoding (also called percent-decoding) resolves percent-encoded sequences such as %20 for a space or %26 for an ampersand. They are completely separate encoding schemes. A URL like example.com/search?q=AT%26T contains URL encoding; a CMS response body with AT&amp;amp;T contains HTML encoding. Use the appropriate decoder for each format.

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.

Source

Formula Source: Standard Mathematical References

by Various

UpdatedLast reviewed: May 2026
CheckedFormula checks are based on standard references and internal QA review.