What Are HTML Entities?
HTML entities are special character sequences that represent characters with reserved meaning in HTML or characters that cannot be typed directly on a standard keyboard. Every entity starts with an ampersand (&) and ends with a semicolon (;).
The five characters that must always be encoded in HTML are:
| Character | Entity | Reason |
|---|---|---|
& | & | Starts an entity reference |
< | < | Opens an HTML tag |
> | > | Closes an HTML tag |
" | " | Delimits attribute values |
' | ' | Delimits attribute values (single-quoted) |
Failing to encode these characters in user-generated content is the root cause of XSS (cross-site scripting) vulnerabilities — one of the most common security issues on the web.
Named vs. Numeric Entities
HTML supports two types of entities:
Named entities use a human-readable name like ©, €, or …. They are defined in the HTML specification and are supported by all modern browsers.
Numeric entities use the Unicode code point of the character, either in decimal (©) or hexadecimal (©). Numeric entities work for any Unicode character, even those without a defined name. Both forms render identically:
| Character | Named | Decimal | Hex |
|---|---|---|---|
< | < | < | < |
© | © | © | © |
€ | € | € | € |
— | — | — | — |
When Do You Need HTML Encoding?
Any time you insert untrusted or dynamic content into HTML, you must encode it first. Common situations:
- Displaying user input in a web page (comments, form fields, search terms)
- Showing code snippets —
<pre><code>blocks need encoded<and> - Blog posts and CMS content with special characters
- Email templates — HTML email clients require encoded entities
- JSON inside HTML — embedded data attributes need encoded quotes
The Entity
(non-breaking space,  ) is a special entity that behaves like a space but:
- Prevents line breaks at its position — words stay together on the same line
- Never collapses — HTML normally collapses multiple spaces into one;
sequences preserve spacing - Adds spacing in HTML without CSS workarounds
Use between a number and its unit (10 kg), in table cells that need to appear non-empty, and wherever a forced space is needed.
How to Use the HTML Entity Encoder
- Paste your plain text or HTML-encoded text into the input box.
- Click Encode HTML to convert
<,>,&,", and'to safe entities. - Click Decode HTML to convert entities back to their original characters.
- Click Copy to copy the result to your clipboard.
The encoder updates live as you type, so you can see results instantly.
All to Numeric Mode
The All to Numeric tab converts every special character — including non-ASCII characters like accented letters, emoji, and symbols — to decimal numeric entities (&#code;). This produces 100% ASCII-safe output that works in any context, including older email clients and XML documents.
For example, Héllo € becomes Héllo €.
Privacy
All encoding and decoding runs entirely in your browser. This tool uses only built-in JavaScript string operations — no external libraries, no server calls. Your data never leaves your device.
Common HTML Entity Quick Reference
The Reference tab above lists 25 frequently used HTML entities with their character, named form, numeric form, and description — useful as a quick lookup while working on HTML templates or email code.