Skip to main content
C
CodeUtil

HTML Encoder / Decoder

Convert special characters to HTML entities and decode them back.

Loading...

How to Use the HTML Encoder

Select whether you want to encode or decode, paste your text, and see the result instantly. Use the swap button to quickly switch between encoded and decoded text.

When to Encode HTML

  • Displaying Code - Show HTML/XML code on web pages without it being interpreted
  • User Input - Sanitize user-submitted content to prevent XSS attacks
  • Email Templates - Ensure special characters display correctly
  • RSS Feeds - Encode content for XML compatibility

HTML Entities Explained

HTML entities are special codes that represent characters that have meaning in HTML or cannot be easily typed. They start with & and end with ;

Types of HTML Entities

  • Named Entities - Like   © &
  • Decimal Entities - Like < > &
  • Hexadecimal Entities - Like < > &

Useful with the Markdown Preview and the URL Encoder when escaping content for the web.

Frequently Asked Questions

What is XSS and how does encoding prevent it?

XSS (Cross-Site Scripting) is a security vulnerability where attackers inject malicious scripts into web pages. HTML encoding converts < and > to their entity equivalents, preventing the browser from interpreting them as HTML tags.

Should I encode all characters?

No, only special HTML characters need encoding. The essential ones are < > & and quotes when inside attributes. Over-encoding can make text harder to read in source code.