Home › Text Tools › HTML Entity Encoder and Decoder

HTML Entity Encoder and Decoder

Escape the characters that HTML reads as markup, or turn named and numeric entities back into text.

Choose a mode, then press Encode or Decode.
Everything runs in your browser. Nothing you type is sent anywhere, and nothing is stored. Decoding turns entities into text only; the page never renders what you paste.

How it works

Encode replaces the five characters that have a meaning in HTML: the ampersand, the less-than and greater-than signs, the double quote and the apostrophe. Each becomes its name, such as < for the less-than sign. These five are always encoded, so the output is safe to put in text or in a quoted attribute.

Named where possible also turns other non-ASCII characters into names when a standard name exists, so é becomes é. A character with no standard name, such as an emoji, becomes a numeric reference. Numeric turns every non-ASCII character into a decimal reference, so é becomes é.

Decode reads named references from a fixed list of the HTML 4 Latin-1 names and a set of common punctuation and symbols. It also reads decimal references (é) and hexadecimal references (é). Each reference is decoded once, so < gives <. A name that is not in the list, a bare ampersand and a reference without its semicolon are left as they are.

Refused references. A numeric reference for a surrogate half (U+D800 to U+DFFF), for zero, or for a number above U+10FFFF is not a character, so decoding stops with a message instead of guessing.