HTML Encoder Decoder Online - Free HTML Entity Converter

HTML Encoder / Decoder

<link rel="canonical"> · <meta name="description">

Input Text
Output
(Output will appear here)

What is HTML Entity Encoding?

HTML entity encoding converts special characters into their corresponding HTML entity representations. For example, the less-than sign (<) becomes <, the greater-than sign (>) becomes >, and the ampersand (&) becomes &. This is essential when you want to display HTML code on a webpage without the browser interpreting it as actual HTML tags.

Why Encode HTML Entities?

When you're building websites or writing content that includes technical documentation, you often need to show HTML tags as text. If you type

directly into a webpage, the browser will interpret it as an actual HTML element and render it. Encoding converts these characters so they display as visible text instead.

Content management systems, discussion forums, and code tutorial websites all rely on HTML entity encoding to safely display user content that might include HTML-like syntax. It prevents cross-site scripting (XSS) attacks by ensuring user input is treated as text, not code.

Common HTML Entities

  • < - Less than sign (&lt;)
  • > - Greater than sign (&gt;)
  • & - Ampersand (&amp;)
  • " - Double quote (&quot;)
  • ' - Single quote (&apos; or &#39;)
  • © - Copyright symbol (&copy;)
  • ® - Registered trademark (&reg;)
  • - Trademark (&trade;)
  •   - Non-breaking space (&nbsp;)

HTML Encoding vs URL Encoding

HTML encoding and URL encoding serve different purposes. HTML encoding targets characters that have special meaning in HTML context, primarily <, >, &, and quotes. URL encoding (percent-encoding) targets characters that are illegal or have special meaning in URLs, such as spaces, slashes, and question marks. Our separate URL Encoder tool handles URL-specific encoding.

FAQ

What's the difference between named and numeric entities?Named entities use words like &lt; for the less-than sign. Numeric entities use numbers: &#60; (decimal) or &#x3c; (hexadecimal). All modern browsers support both, but named entities are easier to read in your source code.
Does this support all Unicode characters?Yes, the encoder can handle any Unicode character. For characters beyond the basic ASCII set, it uses numeric entity format (&#x...) to represent them properly.
Is encoded text safe from XSS attacks?HTML encoding is one of the primary defenses against cross-site scripting. When user input is properly HTML-encoded before display, any injected script tags or JavaScript event handlers become harmless visible text.
Why is my encoded text so long?Each special character expands to multiple characters when encoded. For example, < becomes 4 characters (&lt;). This is expected and necessary for safe HTML display.