HTML Entity Encoder & Decoder
Encode text to HTML entities or decode HTML entities back to text. Supports named entities (< > &) and numeric entities (< <). Essential for safely displaying user content in web pages.
How to Use This Tool
- Choose Encode mode to convert text into HTML entities, or Decode mode to convert entities back to text.
- Paste or type your text into the input field.
- Click "Encode" or "Decode" to process the text.
- Copy the output using the "Copy Output to Clipboard" button.
Common HTML Entities
Frequently Asked Questions
What are HTML entities?
HTML entities are special codes used to display characters that have reserved meanings in HTML or cannot be easily typed. For example, < displays the < character, and & displays the & character. They start with & and end with ;.
When should I encode HTML entities?
You should encode HTML entities when displaying user-generated content to prevent XSS (Cross-Site Scripting) attacks. If a user types <script>alert(1)</script> and you render it without encoding, the browser will execute the script. Encoding converts < to <, making it display as text instead of executing as code.
What are the most common HTML entities?
The five most commonly used entities are: < (<), > (>), & (&), " ("), and ' ('). These characters are reserved in HTML syntax and must be encoded when appearing in text content.
What is the difference between named and numeric entities?
Named entities use a human-readable name like < for less-than. Numeric entities use decimal (<) or hexadecimal (<) code points. All named entities have numeric equivalents, but not all characters have named entities. Numeric entities can represent any Unicode character.