HTML Entities
Free online HTML entity encoder and decoder. Convert special characters to HTML entities and back. All processing happens locally in your browser.
How to Use HTML Entities
Enter Your HTML
Type or paste HTML code or text containing special characters into the input panel.
Choose Direction
Click "Encode" to convert special characters like <, >, & into HTML entities. Click "Decode" to convert entities back to regular characters.
Get the Result
The converted output appears instantly in the right panel. All processing happens locally in your browser.
Examples
Before (Raw HTML)
<div class="example">Hello & Welcome</div>After (HTML Entities)
<div class="example">Hello & Welcome</div>Frequently Asked Questions
What are HTML entities?
HTML entities are special codes used to display characters that have special meaning in HTML. For example, < is encoded as &lt;, > as &gt;, and & as &amp;. Without encoding, these characters would be interpreted as HTML tags rather than displayed as text.
When should I use HTML entity encoding?
You should encode HTML entities whenever you display user-generated content on a web page to prevent XSS (Cross-Site Scripting) attacks. Also use it when you want to display HTML code as text, such as in documentation or code examples.
What is the difference between HTML entities and URL encoding?
HTML entities are for displaying special characters in HTML documents (e.g., &lt; for <). URL encoding is for making URLs safe to transmit (e.g., %3C for <). They serve different purposes and use different encoding schemes.
What characters are encoded?
The main characters that need encoding are: & (ampersand) → &amp;, < (less than) → &lt;, > (greater than) → &gt;, " (double quote) → &quot;, and ' (single quote) → &#39;. These are the five characters that have special meaning in HTML.
Why HTML Entity Encoding Matters
HTML entity encoding is a critical security practice for web developers. Without proper encoding, user input containing HTML tags or JavaScript could be executed in the browser, leading to XSS attacks. Encoding ensures that special characters are displayed as text, not interpreted as code.
The Five Essential HTML Entities
&— ampersand (&)<— less than (<)>— greater than (>)"— double quote (")'— single quote (')