HTML Entity Encoder
Encode special characters (&, <, >, ", ') into HTML entities, or decode HTML entities back to plain text.
- Free to use
- Accurate results
- No registration required
- Works on all devices
Your result
<div class="test">Tom & Jerry's</div>
Result
AI explanation
Formula
Replaces &, <, >, ", ' with their named HTML entities (& < > " ')Worked example
Encode a snippet with quotes, an apostrophe, and an ampersand
| Field | Value |
|---|---|
| Text | <div class="test">Tom & Jerry's</div> |
| Action | encode |
| Result | <div class="test">Tom & Jerry's</div> |
Assumptions
- Covers the 5 characters with dedicated predefined HTML/XML entities — not a full named-entity table (e.g. accented letters are left as-is on encode).
- Decoding also supports numeric entities (A and A), in addition to the 5 named ones.
Frequently asked questions
Why do I need to encode these characters for HTML?
Characters like < and > are structurally meaningful in HTML (they start/end tags) — if you display user-provided or dynamic text containing them without encoding, browsers may misinterpret it as markup, and it can enable cross-site scripting (XSS) attacks.
What is the difference between & and &?
Both represent the same character (&) — & is the named entity, while & is the numeric entity using the character's Unicode code point. Browsers treat them identically.
Does this handle emoji or accented characters?
This tool only encodes the 5 characters with dedicated HTML entities (&, <, >, ", ') — other Unicode characters (emoji, accented letters) pass through unchanged, since modern HTML documents are UTF-8 by default and don't require escaping them.