HTML Encode Online

Encode special HTML characters to entities - free HTML encoder tool

0 characters
0 characters

â„šī¸ About HTML Encoding

HTML encoding converts special characters to their HTML entity equivalents. This is essential for displaying HTML code as text or preventing XSS attacks.

📝 Format Examples

Example 1: Basic HTML Tags

Plain Text Input:

<div>Hello World</div>

HTML Encoded Output:

&lt;div&gt;Hello World&lt;/div&gt;

Example 2: Special Characters

Plain Text Input:

Tom & Jerry said "Hello!"

HTML Encoded Output:

Tom &amp; Jerry said &quot;Hello!&quot;

Example 3: Script Tag (XSS Prevention)

Plain Text Input:

<script>alert('XSS')</script>

HTML Encoded Output:

&lt;script&gt;alert(&#39;XSS&#39;)&lt;/script&gt;

💡 Common Use Cases

  • Preventing Cross-Site Scripting (XSS) attacks
  • Displaying HTML code on web pages
  • Safely storing user input in databases
  • Creating code documentation and tutorials
  • Escaping special characters in XML/HTML