# HTML entity encoder

Encode and decode HTML entities

Use it at https://www.quicktoolz.com/tools/html-entity-encoder. From QuickToolz.

HTML entities let you show characters that would otherwise be read as code. For example, < is written &lt; so the browser shows it as text and doesn’t treat it as a tag. Encode text to make it safe to display, or decode it to get the original back. We warn you about double encoding.

## How it works

Special characters become &name; or &#number;.

Named entities such as &copy; are easy to read. Numeric ones such as &#169; work for any character.

Worked example: <b> becomes &lt;b&gt;, so a browser shows it as text instead of reading it as a tag.

## Examples

| Character | Named | Numeric |
| --- | --- | --- |
| < | &lt; | &#60; |
| & | &amp; | &#38; |
| " | &quot; | &#34; |
| © | &copy; | &#169; |

## What this tool doesn't cover

- Encoding text helps, but it isn’t a full defence against script injection. Use your framework’s escaping too.

## Questions

### Which characters must be encoded?

At least &, <, > and quotes inside attributes.

### What is double encoding?

Encoding text twice, so &amp; becomes &amp;amp;. We warn you when it’s likely.

### Is my data uploaded?

No. Everything runs in your browser.

### What is an HTML entity?

A code that shows a character safely in HTML. For example, &lt; shows a less-than sign without starting a tag.

### How do I show code on a web page?

Encode the characters <, >, and &, then paste the result into your page. The browser shows the code and doesn’t run it.

## Sources

- [WHATWG HTML: named character references](https://html.spec.whatwg.org/multipage/named-characters.html)