Skip to content
BCBinary Code Translator
Menu

Encoding Tool

HTML Entity Encoder / Decoder

Convert reserved HTML characters to entities and decode entities back to readable text for templates, docs, and debugging.

HTML Entity Converter

Encode and decode HTML-safe text locally in your browser.

Conversion direction

What the Encoder Changes

The encoder on this page escapes the five characters that most often need special treatment in HTML text and attributes:

Character Encoded form
& &
< &lt;
> &gt;
" &quot;
' &#39;

For example, <strong>Tom & Jerry</strong> becomes &lt;strong&gt;Tom &amp; Jerry&lt;/strong&gt;, so the markup can be displayed as text instead of being interpreted as HTML.

Decoding Named and Numeric Entities

Decode mode uses the browser’s HTML parser, so common named entities and numeric references can be converted back to characters. Examples include &amp;, &#39;, and &#x27;.

Entity decoding is not the same as sanitizing untrusted HTML. If decoded text is later inserted into a page as HTML, it can become markup again. Use an appropriate HTML sanitizer or framework escaping rules when the source is untrusted.

HTML Entities vs URL Encoding

HTML entities protect or represent characters in HTML syntax. Percent encoding such as %20 represents bytes in URLs and query strings. Base64 is a different binary-to-text encoding again. Use the URL encoder for URLs and the Base64 encoder for Base64 data.

Frequently asked questions

What are HTML entities?

HTML entities are text sequences that represent reserved characters, such as &lt; for < and &amp; for &.

Why encode HTML entities?

Encoding prevents reserved characters from being interpreted as HTML markup and helps display code safely on a page.

Can this decode numeric entities?

Yes. Browser decoding handles common named and numeric entities such as &#39; and &#x27;.

Is this conversion private?

Yes. Encoding and decoding happen locally in your browser.

Related Developer Tools

View all tools

Cookie Preferences

Manage your cookie preferences. Necessary cookies cannot be disabled.

Necessary

Required

Required for language selection, privacy choices, and basic site functionality.

Cookies: NEXT_LOCALE

Analytics

Optional analytics cookies help us understand traffic and improve the website.

Cookies: _ga, _gid, _gat, _clck, _clsk

Advertising

Optional advertising cookies may be used to show relevant ads and measure performance.

Cookies: __gads, _gcl_au, IDE