Developer · FREE ONLINE TOOL
HTML Entity Encoder
Encode and decode HTML entities online. Convert special characters to & < > © and more. Named, numeric, and hex encoding modes. Free, no signup.
Loading tool...
How to use HTML Entity Encoder
- Choose Encode or Decode mode using the toggle
- Select an encoding mode: Named, Numeric, Hex, or All chars
- Paste or type your text into the input box
- The encoded or decoded result appears instantly in the output
- Click Copy to copy the result to your clipboard
- Use Swap to flip input and output and reverse direction
- Click any entry in the Quick Reference table to insert that character
Examples & practical tips
- Encoding user-generated content before rendering as HTML
- Decoding HTML entities in scraped or API content
- Converting copyright, trademark, and currency symbols
- Preparing text for XML or HTML attributes
- Encoding angle brackets in code snippets shown on web pages
About HTML Entity Encoder
The HTML Entity Encoder converts special characters to their HTML entity equivalents and decodes HTML entities back to plain text. Supports named entities (&, <, ©), numeric decimal (&), and hex (&) encoding modes. Includes a quick reference of the most common HTML entities with click-to-insert functionality.
When this comes in handy
- Web developers sanitising user input for HTML output
- Content writers needing to use special characters safely
- Developers debugging entity issues in templates
- Anyone working with XML, RSS feeds, or email HTML
Frequently asked questions
What are HTML entities?
HTML entities are codes used to represent characters that have special meaning in HTML, like < (<), > (>), and & (&). Without encoding, the browser would interpret these as HTML syntax. Entities tell the browser to display the character rather than interpret it.
When should I encode HTML entities?
Always encode user-generated content before rendering it as HTML to prevent XSS attacks. Also encode special characters in HTML attributes, XML documents, and when displaying code snippets or mathematical expressions.
What is the difference between named, numeric, and hex encoding?
Named entities use readable names (& © €). Numeric decimal uses the Unicode code point (& ©). Hex uses the code point in hexadecimal (& ©). All three are equivalent — browsers display them identically.
Does HTML entity encoding prevent XSS?
Encoding the five critical characters (<, >, &, ", ') is the foundation of XSS prevention when rendering untrusted content in HTML. Full XSS protection requires context-aware encoding — different rules apply in HTML attributes, JavaScript, and URLs.
A little more know-how
The Developer's Guide to Encoding: Base64, URL Encoding, and Unicode Explained
Why does 'hello world' become 'hello%20world' in a URL? What is Base64 actually for? A practical guide to encoding for web developers.
Read guideURL Encoder/Decoder Online: Percent Encoding Explained
Master URL encoding and percent encoding. Learn why URLs need encoding, which characters are reserved, and how to encode/decode URLs online instantly.
Read guideKEEP THINGS MOVING
Your next useful shortcut.
Formatters
HTML Minifier
Minify and beautify HTML code. Remove comments, collapse whitespace, optimize file size.
Converters
URL Encoder & Decoder
Encode or decode URLs for safe transmission and storage.
Formatters
JavaScript Beautifier
Beautify and minify JavaScript code with customizable formatting options.