HTML Entity Encoder & Decoder
Convert characters to and from HTML entities — named, decimal or hex, all special chars or only the unsafe five. Round-trip safe.
What are HTML entities?
HTML entities are the escape sequences that let you put characters with special meaning to HTML — <, >, &, ", ' — into a document without the parser interpreting them as markup. They come in three flavours: named (&), decimal numeric (&) and hex numeric (&). All three are decoded identically by browsers; the difference is how readable they are in source.
How to use this tool
Pick Encode to escape text before pasting it into HTML, or Decode to reverse entities back to their original characters. Choose Named for human-readable output (©), Decimal or Hex for legacy environments that don't recognise named entities. Set Scope to unsafe five for normal HTML escaping; switch to all non-ASCII if your target is an ASCII-only context like an old-school email-template engine. The Swap button flips encoded and decoded sides so you can round-trip and confirm nothing was lost.
Named vs numeric — which to pick?
Named entities read better in source — © tells the next developer it's a copyright symbol; © doesn't. They're also slightly more compact for common characters. Numeric entities, on the other hand, are universal: every Unicode codepoint has one, whereas the named-entity table is fixed at the 252 names HTML5 ships with. Use named entities for the common five plus a handful of typographic favourites (—, …, ©); reach for numeric when you hit a character with no canonical name.
The five characters you must always escape
| Character | Named | Decimal | Hex | When to use |
|---|---|---|---|---|
< | < | < | < | Always in element content; otherwise the parser thinks a tag is starting. |
> | > | > | > | Less critical, but escape it for symmetry and to avoid old-browser edge cases. |
& | & | & | & | Always — it starts every entity, so leaving it bare confuses the parser. |
" | " | " | " | Inside double-quoted attribute values. |
' | ' | ' | ' | Inside single-quoted attribute values. Use the numeric entity in HTML4 — ' only became standard in HTML5. |
Frequently asked questions
Do I need to encode every character?
&, <, >, ", '. The all non-ASCII mode exists for legacy systems that aren't UTF-8 clean.Are HTML entities the same as URL encoding?
%20 for space) is for URLs; HTML entities (&) are for HTML. They're different escape mechanisms applied at different layers. Inside an href, you may need both: percent-encode the URL, then HTML-encode the ampersand if it's an attribute.Will ' work in HTML4?
' was introduced as a standard named entity in HTML5; older spec versions only define it in XML. For maximum portability across legacy contexts, use the numeric form '.What does the Decode mode handle?
&, hex &) plus the full HTML5 named-entity set — over 2,200 names. Decode is a strict superset of the encoder.Does this tool send my text anywhere?
How does this differ from JavaScript's encodeURIComponent?
encodeURIComponent percent-encodes for URLs (café becomes caf%C3%A9). HTML entity encoding produces café or café. Use the right one for the right context — and our URL parser if you need to inspect URL encoding instead.
EN
PT
ES