IT Tool

HTML Entity Encoder & Decoder

Encode the five HTML special characters to entities or decode any named, decimal, or hex entity back to text. Runs entirely in your browser.

Instant 100% Client-Side No Login
PROCESSINGLOCAL
LIMITNONE
PRIVACYBROWSER-ONLY
TextEntities

Input

Output

Five characters, and only five, are structural in HTML

An HTML document is text that a browser reads as markup, and the moment your content contains a character the parser treats as structure, the two collide. Only five characters carry structural meaning inside HTML: the ampersand & (code point 38, hex 0x26), the less-than sign < (60, 0x3C), the greater-than sign > (62, 0x3E), the double quote " (34, 0x22), and the single quote or apostrophe ' (39, 0x27). Encoding replaces each of these with an escape sequence so the browser prints the character instead of acting on it. This tool encodes those five in one direction and, going the other way, decodes any HTML entity — named, decimal, or hexadecimal — back to the character it stands for.

Why each of the five matters

The < and > are the obvious pair, because they open and close tags: a comment containing the text <script> becomes the eight literal characters &lt;script&gt; instead of starting a script element. The ampersand is the one people forget — it begins every entity, so the raw string AT&T is ambiguous and should be written AT&amp;T. The two quote characters matter inside attribute values: a stray double quote in title="…"closes the attribute early and turns the rest into new markup. Escaping " to &quot; and ' to &#39;keeps the value sealed. The apostrophe uses the numeric &#39; rather than &apos; on purpose: &apos; was added in HTML5 and XML but is absent from HTML 4, so the numeric form is the one that renders everywhere.

The forward-slash trap

A forward slash is not on that list, and this is where many hand-written escapers go wrong. The slash (code point 47) has no special meaning in HTML text or in a normal attribute value, so escaping it is pure noise: a path like /api/users becomes the unreadable &#x2F;api&#x2F;users with zero security benefit. This tool deliberately leaves the slash — and every other ordinary character, including accented letters like é (233) and emoji like 😀 (128512) — untouched, because the correct escape set is exactly those five structural characters and nothing more. Over-escaping is not safer; it just corrupts your text.

Named, decimal, and hexadecimal — three ways to write the same character

Every escape sequence comes in three interchangeable forms. A named reference is a mnemonic like &amp; or &lt;, bracketed by an ampersand and a required semicolon; HTML5 defines 2,231 of them, from the everyday &nbsp; (160) to the 31-character &CounterClockwiseContourIntegral;. A decimal reference is &# followed by the Unicode code point in base 10, so & is &#38;. A hexadecimal reference is &#x followed by the same code point in base 16, so & is &#x26;. All three resolve to the identical character; named forms read better, while numeric forms can express any of the roughly 1,114,112 Unicode code points even when no name exists.

The decoder here handles all three because it hands the string to the browser's own parser rather than a partial lookup table. It assigns your text to the innerHTML of an off-screen textarea and reads back its value. A textarea parses its content as raw character data, which means entity references are resolved but tags are never turned into live elements — a decoded <script> stays inert text, so the operation cannot execute anything. It is the same engine the browser uses for real pages, so it recognizes all 2,231 named references and every numeric one without a bundled dictionary that could fall out of date.

The honest limit: encoding is context-specific, not a universal sanitizer

HTML entity encoding is the correct defense for exactly one context: HTML text and attribute values. It is not a universal sanitizer. A value placed inside a URL needs percent-encoding, a value inside a <script> block or an inline event handler needs JavaScript string escaping, and a value inside a style rule needs CSS escaping — entity-encoding an attacker's payload in the wrong context can still leave a hole. Real applications should lean on their framework's context-aware auto-escaping — React, Angular, and modern template engines do this by default — and treat a standalone encoder like this one as a way to inspect, learn, and hand-fix a specific string, not as the whole of output safety.

How to Use

1

Choose Encode or Decode with the swap button.

2

Paste your text or entities into the input box.

3

Click the button to convert.

4

Copy the output with one click.

Features

Encodes the five HTML special characters: & < > " '
Leaves ordinary characters like / and accented letters untouched
Decodes named, decimal, and hexadecimal entities
Uses the browser parser, so all 2,231 HTML5 named references resolve
Runs entirely in your browser — nothing is uploaded

Common Questions

About HTML Entity Encoder / Decoder

Encode the five structural HTML characters — & < > " ' — to entities (&amp;, &lt;, &gt;, &quot;, &#39;) without over-escaping ordinary characters like the forward slash. Decode named, decimal, and hexadecimal references back to text using the browser's own parser, so all 2,231 HTML5 named references resolve. Useful for embedding code snippets and inspecting escaped strings.

Also known as: html entity encode, escape html, html special characters, html entity decode, html escape tool, encode ampersand, unescape html, html character references, amp lt gt quot, decode html entities, named html entities, numeric character reference, html encoder decoder, convert html entities.

Processing Note

HTML Entity Encoder / Decoder runs in your browser, so the input you enter is processed locally on this page and is not uploaded to a ToolMintX account.

Tool Limits

IT tools provide quick diagnostics and transformations. They cannot see every private network, deployment setting, proxy, firewall, or production edge case.

Explore More