Tool workspace
HTML decode and HTML encode online
Encode and decode HTML entities for markup, attributes and text.
HTML entity encoder and decoder
Examples
Input
<a href="x">Tom & Jerry</a>
Encoded
<a href="x">Tom & Jerry</a>
HTML Guides & articles
Why HTML Entities Exist
HTML entities let documents represent characters that would otherwise be mistaken for markup, but correct escaping depends on context.
Read articleHow to Decode HTML Entities: JavaScript, PHP, React, and Browser
How to decode HTML entities correctly in JavaScript, Node, PHP, and React, why entities appear as visible text, and why the obvious innerHTML approach is unsafe.
Read articlePreventing XSS With Contextual Output Encoding
Cross-site scripting prevention depends on keeping untrusted data out of executable contexts and encoding for the exact place where data is inserted.
Read articleHTML Encoding, Decoding, and Data Quality
Entity bugs often reveal unclear ownership between storage, APIs, editors, and templates. A consistent data model prevents double encoding and corrupted text.
Read articleHTML Entities List and Cheat Sheet: Arrows, Symbols, and Dashes
A practical reference to HTML entities: which characters must be escaped, the named codes for dashes, arrows, bullets, and symbols, and when to use a character directly instead.
Read articleRelated tools
HTML decode and HTML encode online is often used together with URL decoder and URL encoder online, JSON formatter, validator and beautifier online, Regex tester: test a regular expression online when payloads, tokens, URLs, logs, or markup move through the same workflow.
URL decoder and URL encoder online
Decode URLs, encode values, and inspect URL parts and query params.
Open URL decoder and URL encoder online JSONJSON formatter, validator and beautifier online
Format, minify, validate, sort keys, copy and download JSON payloads.
Open JSON formatter, validator and beautifier online RegexRegex tester: test a regular expression online
Test expressions, flags, matches and replacement output live.
Open Regex tester: test a regular expression onlineHTML entity encoder and decoder
Encode and decode HTML entities for markup, attributes and text. DevToolGrid Online offers a free HTML decode and HTML encode online.
What are HTML entities?
HTML entities are codes such as &, < and > that represent characters which would otherwise be treated as markup or are hard to type. Encoding text into entities is essential for displaying user content safely and preventing cross-site scripting (XSS); decoding turns entities back into the original characters.
How to encode or decode HTML entities
- 1 Paste text or markup into the input panel.
- 2 Choose named, decimal or hexadecimal entities, and special-only or all non-ASCII.
- 3 Click Encode to escape, Decode to unescape, or Strip tags to get plain text.
- 4 Beautify or minify markup, and use the sandboxed preview to see the result render.
Common HTML escaping mistakes
- Not escaping user inputInserting raw user text into a page enables XSS. Always encode &, <, > and quotes before output.
- Escaping in the wrong contextAttribute values, text nodes and URLs need different escaping. Quotes especially matter inside attributes.
- Double encodingEncoding already-escaped text turns & into &amp;. Encode each value once for the right context.
Decode HTML entities in code
Decode HTML entities JavaScript
new DOMParser().parseFromString(s, "text/html").documentElement.textContent
html_entity_decode PHP
html_entity_decode($s, ENT_QUOTES | ENT_HTML5, 'UTF-8')
Node decode HTML entities
import { decode } from "html-entities"; decode(s)
C# decode HTML entities
WebUtility.HtmlDecode(s)
Decode HTML entities React
Decode to a plain string first, then render it normally
HTML entity decode JS (encode)
el.textContent = s // then read el.innerHTML
HTML encoder vs decoder
An HTML encoder converts characters into entities so text is safe to place in markup — it is the step that prevents XSS. An HTML decoder does the reverse, turning entities back into readable characters, which is useful when inspecting scraped or stored content. This tool does both, plus tag stripping, beautify and minify.
FAQ
Is this tool free?
Yes. The HTML entity encoder and decoder are completely free with no limits.
Can I decode HTML entities online here?
Yes. Paste text to decode HTML entities online in the browser. The same html entities converter also encodes, so convert HTML entities online in either direction.
What are HTML entities and why are they used?
They are character references such as &amp; that let a document contain characters the parser would otherwise read as markup. What are character entities in HTML comes down to that one job.
Is my data sent to a server?
No. Encoding, decoding and the preview run locally in your browser; nothing is uploaded.
Does encoding prevent XSS?
Encoding output for the correct context is a key defence against XSS, though a full strategy also uses a content security policy and validation.
What is the difference between named and numeric entities?
Named entities like & are readable; numeric ones like & or & work for any character, even without a defined name.