HTML Entity Encode / Decode
Escape and unescape HTML special characters.
About this tool
The short answer
The five characters that break HTML — <, >, &, and both quote styles — are replaced with named or numeric entities, so user text can be displayed without being interpreted as markup. This is the standard defence against injected markup.
What it depends on
Named entities like & and numeric ones like & are equivalent in modern browsers, but some contexts only accept numeric form. Encoding for an attribute value needs the quote style you actually use escaped.
Where this stops being useful
It escapes text for HTML output; it does not sanitise anything else. Content that will be used in JavaScript, CSS or a URL needs escaping appropriate to that context.
HTML entity encoding replaces characters like <, >, &, and " with their entity forms (<, >, &, ") so they display as text instead of being interpreted as markup. It is essential whenever you show code samples on a page, render user-generated content safely, or drop a snippet into documentation without it breaking the layout.
Paste your text and press Run to escape it; paste escaped text into the decode variant to recover the original. Both run locally in your browser with no upload. This is also a basic XSS-hygiene habit: never inject raw user input into HTML without escaping or using a safe rendering method.
Web developers use this when publishing tutorials that include angle brackets, when building admin screens that preview user content, and when logging structured output for display. Technical writers use it so code blocks render correctly. Security learners use it to understand why escaping matters.
A useful teaching point: there are named entities (&) and numeric ones (&); both are valid and this tool handles the common named set plus numeric forms on decode. Mention that escaping is about correct rendering and safe display — it is not encryption and does not hide data.
For AdSense, frame the page as a short security-and-markup explainer with examples and a FAQ, and link to the URL Encode and Base64 tools that cover adjacent needs. Original, accurate content is the design principle of this entire toolbox — it is what gets a site approved and trusted.
Encoding is the operation that makes arbitrary text safe to place inside markup, and it is the answer to a security question as much as a correctness one. Text containing a less-than sign will be parsed as the start of a tag, so it must be encoded before it goes into an attribute, into a script block, or into content.
Which characters need encoding depends on context. Inside a double-quoted attribute, the characters that matter are the double quote, the less-than, and the ampersand. Inside HTML content rather than an attribute, quotes are harmless and the less-than and greater-than are what break parsing. Encoding more than necessary is safe; encoding less is not.
The ampersand has to be encoded first. The other conversions introduce ampersands of their own, and encoding them out of order produces output that decodes incorrectly, which is one of the classic encoding bugs. This is the reason a correct implementation encodes in a defined order rather than in a convenient one.
A named entity and a numeric one are both valid. The numeric form covers any character, including ones with no named entity, and the hexadecimal numeric form is the general solution for characters outside the basic set.
Encoding is not escaping for a different language. Encoding for JavaScript source, for a URL, for shell, and for HTML are four separate operations with four separate rules, and using the HTML encoder for any of the other three is wrong. Context determines the operation.
The common failure is applying the operation twice, which produces visible entities like an escaped ampersand appearing in the output. That is harmless but ugly, and it signals that a value has already been encoded somewhere upstream and should not be encoded again.
Frequently asked questions
- Is HTML Entity Encode / Decode free?
- Yes. HTML Entity Encode / Decode on FreeKitOnline is free, needs no sign-up, and runs entirely in your browser — nothing you type is uploaded to a server.
- What does HTML Entity Encode / Decode do?
- Free online HTML encoder and decoder. Escape <, >, & and quotes for safe display, or decode them back.
- Is my data private when I use HTML Entity Encode / Decode?
- Yes. HTML Entity Encode / Decode processes everything locally in your browser. We do not receive, store or log what you enter.
Every tool on this site is computed entirely in your browser — nothing you type is uploaded to a server. The information on each page is general information only and is not medical advice.