HTML Entity Encoder & Decoder - Escape and Unescape HTML Online

Tools / Dev Tools / HTML Entity Encoder

HTML entity encoder and decoder

Common HTML entities

Click a box to copy its named code. The second line is the numeric code for the same character.

HTML entities explained

An HTML entity is a short code that stands for a character: &lt; for <, &amp; for &, &eacute; for é. Browsers turn them back into characters when they display a page. This tool converts in both directions right in your browser — paste text to make it safe for HTML, or paste encoded HTML to read it.

How to use it

  1. 1 Choose Encode to turn characters into entities, or Decode to turn entities back into characters.
  2. 2 Paste your text. When encoding, choose whether only the five special characters or everything outside ASCII is converted, and in which format.
  3. 3 Copy the result. A warning appears if the input already looks encoded, or if entities remain after decoding.

Which characters must be encoded

Only five characters have a special meaning in HTML: & starts an entity, < and > open and close tags, and " and ' end attribute values. Encode these whenever you put user text into a page or an attribute — it is also the basic defence against HTML injection. Everything else, including é, ü, ç or Chinese characters, can be written as is when the page is saved and served as UTF-8 (<meta charset="utf-8">). Encoding all non-ASCII characters is only needed for systems that are not UTF-8 safe, such as some old email templates or databases.

Named or numeric?

Named entities such as &eacute; or &copy; are easy to read but exist only for a fixed list of characters: HTML5 knows more than 2,000 names, while older software only knows the 252 from HTML 4. Numeric references work for every character — &#233; (decimal) and &#xE9; (hexadecimal) are the same é — so they are the safest choice. With “Named where possible” the tool uses an HTML 4 name when there is one and hexadecimal otherwise. &apos; is not part of HTML 4, so the apostrophe is always written as &#39;.

The double encoding trap

If text that already contains &lt; is encoded again, its & becomes &amp; and you get &amp;lt;. The browser then shows the literal text &lt; instead of a < sign — the familiar &amp;amp; and &amp;quot; on badly built pages. It usually happens when a template escapes text that was already escaped before it was stored. Decode once and look at the result: if entities are still there, the tool offers to decode again.

Emoji and other characters above U+FFFF

JavaScript stores emoji and other characters above U+FFFF as two 16-bit halves, a so-called surrogate pair. Tools that encode one half at a time turn the grinning face into &#xD83D;&#xDE00; — two invalid references that browsers display as two replacement characters (�). This tool reads whole code points, so the same emoji becomes &#x1F600; (decimal &#128512;). Emoji built from several code points, such as flags, skin tones or family groups, are encoded as a sequence of references and come back intact when decoded.

HTML entities: common questions

Not if the page is UTF-8, which almost every modern site is — write é directly. Encode accented letters only for systems that cannot handle UTF-8; then choose “Special characters and everything outside ASCII”.
New
Subnet Calculator Enter an IPv4 address with a CIDR prefix or netmask to get the network and broadcast address, usable host range, host count, wildcard and binary view.
Popular Today
MD5 Hash Generator Free MD5 hash generator: turn any text or file into an MD5 checksum in your browser - useful for integrity checks and quick fingerprinting.

Related Dev Tools

MD5 Hash Generator Free MD5 hash generator: turn any text or file into an MD5 checksum in your browser - useful for integrity checks and quick fingerprinting.
Base64 Encoder & Decoder Free Base64 encoder and decoder: convert text or files to Base64 and back, entirely in your browser - nothing is uploaded to a server.
JWT Decoder Free JWT decoder: paste a token to read its header, payload and signature in a readable form - decoding happens in your browser, nothing is sent.
URL Encoder & Decoder Free URL encoder and decoder: convert links and query parameters to percent-encoding and back, with full-URL and component modes, in your browser.
UUID Generator Free UUID generator: create v1, v4 and v5 identifiers instantly, generate them in bulk and copy any value with a single click - no signup needed.

Other Tools You May Like

Word to PDF Convert Word to PDF for free: upload a DOC, DOCX, ODT or RTF file and download a properly formatted PDF in seconds - no registration or watermark.
PDF to Word Convert PDF to Word for free: upload a PDF and download an editable DOCX in seconds - no registration, no watermark and nothing to install.
Word Counter Free word counter: paste any text to count words, characters, sentences and paragraphs, and see the estimated reading time - nothing leaves your browser.
Character Counter Free character counter: count characters with and without spaces, plus words and lines, and check SEO limits for titles and meta descriptions.
Keyword Density Checker Free keyword density checker: paste text or a URL to see how often each word and phrase appears, with percentages for one, two and three-word terms.