HTML Entity Encoder & Decoder
Convert special characters to HTML entities and back. 100% client-side — your data never leaves your browser.
No data sent to serverRelated Tools
What are HTML Entities?
HTML entities are escape sequences that let you display characters with special meaning in HTML — or characters hard to type. The most critical: < for <, > for >, & for &. Without escaping, the browser interprets these as HTML markup, breaking your page layout — or worse, creating XSS vulnerabilities.
Three entity formats
The HTML5 spec (WHATWG Living Standard) defines three equivalent ways to encode a character:
- Named entities:
©(©),→(→),—(—) - Decimal numeric:
©(©) — Unicode code point in decimal - Hex numeric:
©(©) — Unicode code point in hex
When to encode
- Displaying user input on an HTML page (always — XSS prevention)
- Showing code samples in
<pre>blocks - Embedding HTML strings inside attribute values
- Storing HTML in databases that serve to untrusted clients
- Email templates with user-supplied content
Common HTML Entities
Critical (must encode)
| Char | Named | Numeric |
|---|---|---|
| < | < | < |
| > | > | > |
| & | & | & |
| " | " | " |
| ' | ' | ' |
Punctuation and typography
| — (em dash) | — | — |
| – (en dash) | – | – |
| … (ellipsis) | … | … |
| ' (curly apostrophe) | ’ | ’ |
| " / " | “ / ” | “ / ” |
| © (copyright) | © | © |
| ® (registered) | ® | ® |
| ™ (trademark) | ™ | ™ |
| (non-breaking space) | |   |
Math and symbols
× (multiply) × × ÷ (divide) ÷ ÷ ± (plus/min) ± ± ≈ (approx) ≈ ≈ ≠ (not eq) ≠ ≠ ≤ (less eq) ≤ ≤ ≥ (greater) ≥ ≥ ∞ (infinity) ∞ ∞ → ← ↑ ↓ → ← ↑ ↓
Note: The HTML5 spec (WHATWG) defines over 2,000 named entities. Most modern code uses numeric or named entities only for the few characters that absolutely need escaping; UTF-8 handles everything else natively.
Frequently Asked Questions
Does this support numeric entities like ©?
Yes. Both encoder and decoder handle named entities (©), decimal numeric (©), and hex numeric (© or ©).
Is this safe to use with sensitive content?
Yes. All processing happens in your browser. Verify in DevTools Network tab — no external requests are made when encoding/decoding.
Should I encode all non-ASCII characters?
No, with UTF-8 encoding (the modern default), non-ASCII characters like Korean or emoji can appear directly. Only escape the five HTML-significant characters (< > & " '). Force-encoding all non-ASCII just bloats your HTML.
What's the difference between ' and '?
Both produce '. ' is a named entity defined in HTML5 (not in HTML4). For maximum compatibility with very old systems, use '. In practice, all modern browsers accept both.
Do I need to encode characters inside <textarea>?
Yes — textarea is a content element, not a "raw text" element. < inside textarea must be encoded as < for correct rendering. <script> and <style> are exceptions (raw text elements).
Are HTML entities the same as URL encoding?
No, they're different. HTML entities (<) are for embedding in HTML. URL encoding (%3C) is for embedding in URLs. Don't mix them — wrong context produces double-encoded or broken output.
Which characters actually need encoding?
In HTML body text, the ampersand and the less-than sign are the ones that genuinely break parsing. Inside attribute values you also need to encode whatever quote character delimits the attribute. The greater-than sign is encoded by convention rather than necessity, which is why you see it escaped even where it would be harmless.
Is entity encoding enough to prevent XSS?
Only in the right context. Encoding is context-dependent: what is safe in body text is not sufficient inside a script block, a style block, an event handler attribute, or a URL. Treating entity encoding as a universal defence is a well-documented way to ship a vulnerability.
What is the difference between named and numeric entities?
Named entities such as & are readable but limited to a defined list. Numeric entities such as & work for any character in Unicode. Numeric is the safer choice for unusual characters, and named is easier for a human to read in source.
Do I still need entities for accented and non-Latin characters?
Not if the page declares UTF-8, which every modern page does. Encoding them was a workaround for the days of ambiguous character sets, and doing it today just makes the source harder to read.
⚠️ Reference Only
Output is generated based on your input and is provided for reference. Results may vary depending on your specific use case, edge cases, or environment-specific behavior. We do not guarantee accuracy of conversions, validations, or computed values.
Always verify critical outputs against official documentation or production environments. We are not responsible for any decisions or losses based on these tool results.
📖 Related Guides
Color Formats — HEX, RGB, HSL, OKLCH
Modern CSS color formats explained. When to use OKLCH for perceptual uniformity.
REST vs GraphQL vs gRPC — Choosing an API Paradigm
Trade-offs across performance, tooling, type safety, and team shape. When to use each.
UUID v4 vs ULID — Which to Choose?
Compare UUID v4 and ULID for distributed systems. Performance, sortability, and use cases.