HTML Decode: Convert HTML Entities Back to Characters
Convert HTML entities like <, &, and " back to their original characters. Useful for reading encoded HTML content and template debugging.
Try the free online tool
Runs entirely in your browser — no signup, no uploads.
HTML-encoded strings are safe for browser rendering but difficult to read and work with in raw form. When you encounter a string full of <, &, >, ", and ' sequences in a database export, CMS output, or API response, HTML decoding converts them back to the original characters so you can read the content naturally.
HTML decoding is also necessary when processing HTML content programmatically. Scraping a web page, parsing an RSS feed, or extracting text from an HTML email often requires decoding entities before you can work with the text. Leaving entities encoded in your extracted text will produce garbled output in reports, search indexes, or downstream systems.
This tool converts all HTML entities back to their corresponding characters instantly in your browser. It handles named entities like and ©, decimal numeric entities like ©, and hexadecimal numeric entities like ©.
What Is HTML Decoding?
HTML decoding (also called HTML unescaping) is the reverse of HTML encoding. It scans a string for HTML entity sequences and replaces each one with the character it represents. Named entities like & are replaced with &, numeric decimal entities like < are replaced with <, and hexadecimal entities like < are also decoded to <.
The HTML specification defines over 2,000 named character references. A complete HTML decoder must handle all of them, not just the common five. For example, — produces an em dash (—), © produces the copyright symbol (copyright), and € produces the euro sign (euro).
Unlike HTML encoding, which can be applied safely to any text, HTML decoding should be used carefully. Decoding HTML entities in content from an untrusted source will restore the original characters, including any script tags or event handlers that were originally encoded. Always validate the decoded content before using it.
How to Use This Tool
Decoding HTML entities is straightforward with this tool.
- 1
Paste the HTML-encoded string
Copy the string containing HTML entities from your CMS, database, API response, or source code and paste it into the input field.
- 2
Click Decode
The tool processes all HTML entity sequences and replaces them with their corresponding characters.
- 3
Read the decoded output
The output field shows the original text with all entities converted to readable characters.
- 4
Copy and use the result
Copy the decoded text for use in your document, code, or downstream processing.
Common Use Cases
HTML decoding is useful whenever encoded content needs to be read or processed as plain text.
- Converting HTML-encoded content from a CMS or database back to readable text for editing or migration.
- Decoding HTML entities in RSS and Atom feed descriptions for display in native applications.
- Processing scraped web page content where entities must be resolved before text analysis.
- Reading encoded API responses from social media platforms that HTML-encode tweet or post content.
- Debugging double-encoded content by decoding one layer at a time.
- Extracting clean text from HTML email templates for testing in plain-text clients.
Tips and Best Practices
- Use your programming language's built-in HTML entity decoder rather than regex substitution; regex-based decoders miss edge cases and obscure entity formats.
- In Python, use html.unescape() from the standard library. In PHP, use html_entity_decode(). In JavaScript, set the innerHTML of a temporary DOM element and read its textContent.
- Be aware of double-encoded content; if &lt; appears in the source, one decode gives < and two decodes give <. Identify how many encoding layers were applied.
- After decoding, do not render the decoded HTML in a browser unless you trust the source; decoded script tags will execute.
- When decoding content for a search index or NLP pipeline, also strip remaining HTML tags after entity decoding to get clean plain text.
Frequently Asked Questions
How do I decode HTML entities in JavaScript?
Create a temporary textarea element, set its innerHTML to the encoded string, and read its value property: const decode = s => { const t = document.createElement('textarea'); t.innerHTML = s; return t.value; }. This lets the browser's HTML parser handle all entity types natively.
What is a non-breaking space entity ( ) and how should I handle it?
decodes to Unicode character U+00A0 (non-breaking space), not a regular ASCII space (U+0020). If you are processing text for word counting or search, you should normalise non-breaking spaces to regular spaces after decoding, or your string operations may produce unexpected results.
Why does my decoded content still show entity sequences?
The string may be double-encoded. For example, &lt; must be decoded twice to become <. Apply the decoder once to get <, then decode again to get <. Check the raw source to count how many encoding layers were applied.
Can HTML decoding be dangerous?
Decoding HTML entities restores characters that were encoded for safety. If the decoded content is then rendered as HTML in a browser, any injected script or event handler tags become active. Always treat decoded content as untrusted and sanitise it before rendering.
What is the difference between html.unescape() and BeautifulSoup's entity handling in Python?
html.unescape() from the standard library handles all standard HTML5 named character references efficiently without external dependencies. BeautifulSoup also decodes entities but is primarily a full HTML parser for tree-based document processing. For simple entity decoding, html.unescape() is faster and has no dependencies.
Does HTML decoding handle all 2,000+ named HTML entities?
A complete decoder should handle all named character references defined in the HTML5 specification, including entities like ½, α, ♥, and “. Incomplete decoders that only handle the five basic entities will leave other entities encoded. This tool handles the full HTML5 named entity list.
Ready to use this tool?
Free, instant, no account required. Runs entirely in your browser.