# HTML Entity Encoder/Decoder

> Encode &, <, > and quotes as HTML entities or decode entities back to readable text, including decimal and hex numeric references. Live output as you type.

- Open the tool: https://overtooled.com/html-entities
- Category: Developer
- Privacy: Runs entirely in your browser. Nothing is uploaded, no account is needed, and it works offline once loaded.
- Price: free, no sign-up
- Keywords: html, entity, encode, decode, escape, amp, lt, gt

## In short

Encode special characters to HTML entities and decode them back.

## Overview

Converts text to HTML-safe form by escaping the five HTML-special characters, or decodes those entities and numeric character references back to text. Use it to escape code snippets or user text for HTML, or to read escaped strings from APIs and databases.

## Features

- Encode / Decode mode toggle; output updates as you type
- Encode escapes & < > " ' as &amp; &lt; &gt; &quot; &#39;
- Decode handles every HTML5 named entity (&nbsp; &copy; &apos; &hellip; ...), decimal references (&#60;), and hex references (&#x3C;), including emoji above U+FFFF
- Decoding is single-pass like a browser: &amp;#60; becomes the text &#60;, not <
- Side-by-side input and read-only output panes
- Copy and Pipeline buttons on the output; Clear button on the input

## How to use it

1. Choose Encode or Decode
2. Type or paste text into the left pane
3. Copy the result from the right pane

## Inputs

- Any text (Encode) or entity-encoded text (Decode)

## Outputs

- Encoded or decoded plain text

## Limits and notes

- Encoding only touches & < > " '; non-ASCII characters are left as-is (no &#...; or named-entity output)
- Decoding follows browser rules for HTML text, so a few legacy entities are recognised without a trailing semicolon ("&copy 2024" decodes to the copyright sign); unknown names are left as typed
- Invalid numeric references (&#0;, surrogates, values above U+10FFFF) become U+FFFD, and &#128;-&#159; map to Windows-1252 characters, as browsers do
- Switching between Encode and Decode moves the result into the input
- Nothing is saved to localStorage; runs entirely in the browser

## Questions and answers

### How does the HTML Entity Encoder work?

Encoding replaces the five HTML-special characters (&, <, >, ", ') with &amp;, &lt;, &gt;, &quot;, and &#39;. Decoding uses the entities library to follow the browser's HTML rules in a single pass: every HTML5 named entity (&nbsp;, &copy;, &hellip;, and so on) plus decimal (&#60;) and hex (&#x3C;) references are converted, including emoji above U+FFFF. Because it is single-pass, &amp;#60; becomes the text &#60;, not <.

### What are HTML entities?

HTML entities are special codes that represent characters in HTML. For example, &lt; represents <, &amp; represents &, and &nbsp; represents a non-breaking space. They prevent browsers from misinterpreting characters as HTML tags.

### When do I need to encode HTML entities?

When displaying user-generated content, code snippets, or any text that contains characters like <, >, &, or quotes in HTML. Encoding prevents cross-site scripting (XSS) and rendering errors.

### Can I decode entities back to normal text?

Yes. Decode mode converts every HTML5 named entity (such as &amp;, &nbsp;, &copy;, and &apos;) and any decimal (&#60;) or hex (&#x3C;) numeric reference back to characters, including emoji such as &#128512;. Like a browser, it also recognizes a few legacy entities without the trailing semicolon and leaves unknown names as typed.

## Related tools

- [Base64 Encode/Decode](https://overtooled.com/base64.md): Encode text to Base64 or decode Base64 strings instantly
- [URL Encode/Decode](https://overtooled.com/url-encode.md): Encode and decode URLs, query parameters, and special characters
- [HTML to PDF](https://overtooled.com/html-to-pdf.md): Convert HTML code or files to downloadable PDF documents
- [JWT Decoder](https://overtooled.com/jwt-decoder.md): Decode and inspect JWT token headers, payloads, and claims

---
Overtooled: 179 free tools that run in your browser. Index of all tools: https://overtooled.com/llms.txt
