HTML Entity Encoder / Decoder
Convert special characters to HTML entities and back. Useful for embedding code in web pages, preventing XSS, and ensuring valid markup.
Embed this toolEncoder / Decoder
Advertisement
Understanding HTML Entities
HTML entities are the bridge between raw text and structured markup. Every web developer encounters them when displaying code examples, handling user input, or working with special characters. The concept dates back to the early days of the web when documents needed a way to include characters that were either unavailable on keyboards or reserved for markup syntax.
The five essential entities—&, <, >,", and '—form the foundation of safe HTML authoring. Beyond these, HTML5 recognizes over 2,000 named entities covering mathematical operators, Greek letters, arrows, and currency symbols. When a named entity does not exist for a particular character, numeric entities provide universal access to the full Unicode repertoire.
Character encoding standards have evolved dramatically since ASCII's 128-character limitation. UTF-8, specified in RFC 3629 and now used by over 98% of web pages, elegantly solves the multilingual challenge by using variable byte lengths. While UTF-8 eliminates many historical reasons for using entities, they remain indispensable for escaping reserved characters and ensuring documents remain valid across different parsers and processing pipelines.
Common Entity Reference
| Character | Named Entity | Numeric (Decimal) | Description |
|---|---|---|---|
| & | & | & | Ampersand |
| < | < | < | Less-than sign |
| > | > | > | Greater-than sign |
| " | " | " | Double quote |
| ' | ' / ' | ' | Single quote / apostrophe |
| |   | Non-breaking space | |
| © | © | © | Copyright symbol |
External References
- Wikipedia — Character encodings in HTML
- Wikipedia — List of XML and HTML character entity references
- WHATWG HTML Living Standard — Named characters
- W3C — Using character escapes in markup and CSS
Related NerdsTips Tools
- URL Encoder / Decoder — Percent-encode text for safe use in URLs and query strings.
- Base64 Encoder / Decoder — Encode binary data as ASCII-safe text strings.
- Text to Slug Converter — Convert any text to clean, URL-friendly slugs.