Decode HTML entities to plain text
Decode HTML entities to plain text instantly with our free online HTML decoder tool. This decoder helps web developers and content managers convert HTML entities like &, <, >, and " back into readable characters for editing and analysis. Simply paste your HTML-encoded text and get the decoded output in real-time.
HTML decoding converts HTML entities back to their original characters. This is needed when processing HTML content that contains encoded entities, extracting plain text from HTML, or working with data that was HTML-encoded for safe storage.
The decoder identifies entity patterns (&name; or &#number; or &#xhex;) and replaces them with corresponding characters. Named entities use a lookup table, numeric entities convert the number to its Unicode character.
Entity types: named (& → &), decimal (& → &), hexadecimal (& → &). There are 252 named entities in HTML5. Numeric entities support any Unicode code point. Invalid entities may be passed through unchanged or trigger errors.
Convert HTML content to plain text for processing.
& and <br> → & and <br>Decode HTML-encoded data received from APIs.
Convert HTML content to searchable plain text.
Decode legacy data that was stored HTML-encoded.
// Using DOM (browser)
function htmlDecode(str) {
const doc = new DOMParser().parseFromString(str, 'text/html');
return doc.documentElement.textContent;
}
// Using textarea (browser, simpler)
function htmlDecode(str) {
const textarea = document.createElement('textarea');
textarea.innerHTML = str;
return textarea.value;
}
// Node.js (he library)
import he from 'he';
he.decode('<div>'); // '<div>'Browser DOM decodes automatically. For Node.js, use the he library for comprehensive entity support.
import html
# Decode entities
text = html.unescape('<script>')
# '<script>'
# Handles numeric entities too
text = html.unescape('<>')
# '<>'
# BeautifulSoup for HTML content
from bs4 import BeautifulSoup
soup = BeautifulSoup(html_content, 'html.parser')
plain_text = soup.get_text()html.unescape decodes all HTML entities. BeautifulSoup extracts plain text from HTML documents.
Use HTML decoding when extracting text from HTML, processing HTML-encoded API responses, or converting data for non-HTML display. Always consider security when decoded content will be displayed.
Decode when: extracting plain text from HTML, processing API data that's HTML-encoded, migrating data between systems, or displaying in non-HTML contexts. Don't decode if you're going to display in HTML again.