# HTML Entity Encoder / Decoder

> Free HTML entity encoder and decoder. Convert text to HTML entities and back, with named or numeric output. All client-side.

Encode text into HTML entities (&amp;lt; &amp;gt; &amp;amp;) or decode entities back to text. Choose named entities for common characters or numeric entities for everything.

*Interactive tool: enter your values at https://toollantern.win/html-entity-encoder-decoder/ and results update instantly in your browser.*

## What the tool does

HTML entities let you display reserved characters safely: < becomes <, & becomes &amp;. Encoding also prevents cross-site scripting when you insert user text into a page. Decoding reverses the process, turning &copy; back into ©.

## Named vs numeric

By default common characters use readable named entities (< > &amp; ") and anything else uses numeric codes (&#169;). Check the box to force numeric entities for every character.

## Worked example

Encoding **5 > 3 & 2 < 4** gives 5 > 3 &amp; 2 < 4, which renders in a browser exactly as the original text.

## Frequently asked questions
### What is an HTML entity?

A code like < or &#169; that represents a character in HTML. Entities let you show characters that would otherwise be interpreted as markup, like angle brackets and ampersands.

### When should I encode text?

Whenever you insert untrusted or user-supplied text into HTML. Encoding  & and quotes neutralizes injected scripts, which is the basic defense against XSS.

### Named or numeric entities?

Both render identically. Named entities (<) are readable; numeric entities (&#60;) cover every Unicode character including emoji. This tool uses named for common characters and numeric for the rest by default.

### Is my text sent to a server?

No. Encoding and decoding happen locally in your browser.

---
Interactive version: https://toollantern.win/html-entity-encoder-decoder/
