← Back to all tools

🔣 HTML Entity Encoder/Decoder

Convert special characters to HTML entities and back

Common HTML Entities Reference

About HTML Entity Encoder

Encode special characters like <, >, &, quotes, and non-ASCII characters into HTML entities. Decode them back to readable text. Essential for safely embedding text in HTML or preventing XSS. Runs entirely in your browser.

How to Use HTML Entity Encoder/Decoder

  1. Paste text containing special characters
  2. Click Encode to convert to HTML entities
  3. Or paste HTML entities and click Decode to get the original text
  4. View named entities (&) and numeric codes (&)
  5. Copy the result for use in your HTML

About HTML Entity Encoder/Decoder

HTML entities are special codes that represent characters which have meaning in HTML syntax or aren't available on standard keyboards. The most common: & for &, < for <, > for >, " for ", and   for non-breaking space. Without encoding, characters like < and > would be interpreted as HTML tags, breaking your page or creating security vulnerabilities (XSS attacks). This tool converts between raw text and HTML entities in both directions. Beyond security, entities are used for special characters like © (©), ™ (™), € (€), and mathematical symbols. The encoder handles named entities where available and falls back to numeric codes for other characters.

Frequently Asked Questions

Why do I need HTML entities?

Characters like < > & " have special meaning in HTML. Without encoding, a < in user content could start an HTML tag, breaking layout or enabling XSS attacks. Encoding converts them to safe representations.

What's the difference between named and numeric entities?

Named: & (human-readable). Numeric: & (decimal) or & (hex). Named entities exist for common characters; numeric works for any Unicode character. Browsers support both equally.

Do I need to encode everything?

Only characters with special HTML meaning (&, <, >, ", ') need encoding. Regular text, letters, numbers, and most punctuation are fine as-is. Server-side frameworks usually auto-encode user input.

What about UTF-8?

With UTF-8 encoding (standard for modern web), most characters can be used directly without entities. Entities are still required for HTML-special characters (<, >, &) and are useful for characters not on your keyboard.

How does this prevent XSS attacks?

XSS (Cross-Site Scripting) injects malicious HTML/JavaScript via user input. Encoding converts < to < so

Related Tools

URL Encoder → HTML Beautifier → Base64 Encoder → Code Minifier →