How do I encode or decode HTML entities online?
Paste text containing special characters like <, >, &, or " and click Encode to convert them to HTML entities (<, >, &). Paste encoded text and click Decode to restore the original characters. The tool handles all named and numeric HTML entities. Everything runs in your browser.
<div class="alert">Price: $5 & up</div>
<div class="alert">Price: $5 & up</div>
HTML Entity Encoder & Decoder
Encode special characters as HTML entities or decode entities back to text. Fast, private, and free.
Common HTML Entities
| Character | Named | Numeric | Description |
|---|---|---|---|
| & | & | & | Ampersand |
| < | < | < | Less than |
| > | > | > | Greater than |
| " | " | " | Double quote |
| ' | ' | ' | Single quote |
| ␣ | |   | Non-breaking space |
| © | © | © | Copyright |
| ® | ® | ® | Registered trademark |
| ™ | ™ | ™ | Trademark |
| € | € | € | Euro sign |
| £ | £ | £ | Pound sign |
| — | — | — | Em dash |
| – | – | – | En dash |
| … | … | … | Ellipsis |
| ° | ° | ° | Degree |
| × | × | × | Multiply |
| ÷ | ÷ | ÷ | Divide |
| → | → | → | Right arrow |
Quick Reference
Minimal mode encodes only the 5 characters that are special in HTML/XML: & < > " '. Use this when your text contains HTML tags or attributes.
All Characters mode also encodes every non-ASCII character (accented letters, symbols, emoji) using named entities where available, or numeric codes. Use this when you need pure ASCII output.
Decoding recognizes named entities (&), decimal codes (©), and hex codes (©).
Tips & Best Practices
HTML entity encoding prevents XSS attacks
Converting < to < and > to > in user-generated content prevents browsers from interpreting it as HTML. This is the fundamental defense against Cross-Site Scripting (XSS). Also encode & (to &), " (to "), and ' (to '). Modern frameworks like React do this automatically in JSX expressions.
Double encoding produces visible &amp; in output
If your template engine already escapes HTML and you manually encode before passing data, users see literal &lt; instead of <. This happens frequently when switching between raw HTML and framework templates. Encode exactly once, at the output layer closest to the browser.
Use numeric entities for special characters in email HTML
Email clients have inconsistent HTML entity support. Named entities like — may not render in all clients (especially Outlook). Numeric entities (— for em dash, © for copyright) have broader support. For maximum compatibility, use UTF-8 encoding and avoid entities entirely where possible.
The 5 mandatory HTML entities you must always encode
In HTML content: < (<), > (>), & (&). In HTML attributes: add " (") and ' ('). These 5 characters have special meaning in HTML — failing to encode them in user input creates either broken markup or security vulnerabilities. Everything else can be left as UTF-8.
Frequently Asked Questions
What are HTML entities and when should I use them?
What is the difference between HTML encoding and URL encoding?
How do I prevent XSS attacks with HTML encoding?
Related Convert Tools
JSON ↔ XML Converter
Convert JSON to XML and XML to JSON instantly — handles nested objects, arrays, attributes, CDATA sections, and XML declarations
CSS Unit Converter
Convert between px, rem, em, pt, vw, vh, and % — single values or batch-convert entire CSS files with configurable base font size
Base64 Codec
Encode and decode Base64 strings with Unicode support
Color Converter
Convert colors between HEX, RGB, and HSL formats