What does the HTML Entity Decoder do?
The HTML Entity Decoder converts encoded entity strings (<, >, &, ", ', <) back into raw, unescaped HTML markup code and readable plain text characters. It decodes all W3C standard named entities, decimal codes (<), and hexadecimal unicode entities (<).
Core Concepts
Understanding HTML entity unescaping mechanics:
- Named Entity Mapping: Replaces standard HTML entities like
<(<),>(>),&(&),"("), and'(') with their native characters. - Decimal Code Processing: Resolves ASCII decimal entities (
",<,>) via character code point lookups. - Hexadecimal Entity Resolution: Translates hexadecimal unicode escapes (e.g.
<,&) into raw UTF-8 glyphs.
How to use the tool?
- Enter Encoded HTML: Paste your entity-encoded string into the input editor or click Load Sample.
- Execute Decode: Click Decode HTML Entities to convert entities into unescaped plain characters.
- Inspect & Copy: Review the decoded output and entity count, then click Copy or Download.
Related Developer Utilities
If you work with HTML entities, markup sanitization, and text formatting, explore these complementary tools:
- HTML Entity Encoder: Convert reserved characters into named, decimal, or hex entities.
- HTML Formatter & Beautifier: Format and indent unescaped HTML documents.
- HTML Tag Stripper: Remove all HTML tags and extract clean plain text.
- HTML to Markdown Converter: Convert HTML documents into GitHub Flavored Markdown.
REST API Integration
Blueutils provides a free REST API endpoint (POST https://blueutils.com/api/html/html-decoder) to programmatically decode HTML entities back to raw unescaped HTML markup code.
API Request Parameters
| Name | Type | Description | Example |
|---|---|---|---|
rawText |
String | HTML entity-encoded string payload to decode. | "<div class="card">Hello & World</div>" |
API Request Payload Examples
cURL
curl -X POST https://blueutils.com/api/html/html-decoder \
-H "Content-Type: application/json" \
-d '{
"rawText": "<div class="card">Hello & World</div>"
}'Python
import requests
url = "https://blueutils.com/api/html/html-decoder"
payload = {"rawText": "<div class="card">Hello & World</div>"}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String jsonPayload = """
{
"rawText": "<div class=\\"card\\">Hello & World</div>"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://blueutils.com/api/html/html-decoder"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}API Response Parameters
| Name | Type | Description | Example |
|---|---|---|---|
isValid |
Boolean | Indicates whether decoding succeeded. | true |
entityCount |
Number | Total count of entities decoded. | 4 |
decodedText |
String | Unescaped plain-text HTML string. | "<div class=\"card\">Hello & World</div>" |
output |
String | Decoded HTML output string. | "<div class=\"card\">Hello & World</div>" |
API Response Payload Examples
Success Response (HTTP 200 OK)
{
"isValid": true,
"entityCount": 4,
"decodedText": "<div class=\"card\">Hello & World</div>",
"output": "<div class=\"card\">Hello & World</div>"
}Validation Failure Response (HTTP 400 Bad Request)
{
"isValid": false,
"error": "Invalid input: HTML entity payload to decode cannot be empty."
}Rate Limit Exceeded Response (HTTP 429 Too Many Requests)
{
"error": "API rate limit exceeded. Please wait or contact support@blueutils.com."
}Why use an API to decode HTML entities?
Integrating the HTML Entity Decoder API into web crawlers, log ingestion tools, or AI agent tool calling provides key benefits:
- Rapid Script Validation: Unescapes serialized HTML payloads from database records and API error responses automatically.
- Optimized Token Efficiency for AI Agents: LLMs frequently struggle with double-escaped HTML entities. Invoking the API normalizes text deterministically without consuming token budget.
- Deterministic Accuracy Without Hallucinations: Ensures 100% accurate named, decimal, and hexadecimal entity resolution.
Native Usage
How to decode HTML entities locally in terminal environments or scripts:
Windows (CMD / PowerShell)
# Decode HTML entities in PowerShell
[System.Net.WebUtility]::HtmlDecode('<div>Hello & World</div>')Linux / Unix (Bash)
# Decode HTML entities using Python in Linux
python3 -c "import html; print(html.unescape('<div>Hello & World</div>'))"Python
Using Python html.unescape:
import html
encoded_text = '<div class="card">Hello & World</div>'
decoded_text = html.unescape(encoded_text)
print("Decoded:", decoded_text)Java
Using Java String.replace:
public class HtmlDecoderExample {
public static void main(String[] args) {
String encoded = "<div>Hello & World</div>";
String decoded = encoded.replace("&", "&")
.replace("<", "<")
.replace(">", ">")
.replace(""", "\"");
System.out.println(decoded);
}
}