Skip to content
Butter Tools Logo
Butter Tools

HTML Encode / Decode

Escape HTML special characters to safe entities, or decode entities back to their original characters. Perfect for embedding code in web pages.

HTML / text input
Encoded output

Common HTML Entities

& &
< &lt;
> &gt;
" &quot;
' &apos;
SP &nbsp;
© &copy;
® &reg;
&trade;
&euro;
£ &pound;
¥ &yen;
&hellip;
&mdash;
&ndash;
× &times;
menu_book

How to Use HTML Encoder / Decoder

To HTML-encode text, paste your content into the input field and select Encode. Characters that have special meaning in HTML — such as <, >, &, and quotes — are converted to their HTML entity equivalents (e.g. < becomes &lt;). This prevents browsers from interpreting the text as HTML markup.

To decode, switch to Decode mode and paste HTML entities into the input. The tool converts all entities back to their original characters. This is essential when working with HTML template content, sanitising user input for display in web pages, or debugging HTML escaping issues.

help

Frequently Asked Questions

Why do I need to HTML-encode text? expand_more

HTML encoding prevents special characters from being interpreted as HTML markup. Without encoding, characters like < and > would break page structure or create cross-site scripting vulnerabilities.

What are the most important HTML entities to know? expand_more

The most critical HTML entities are &lt; for <, &gt; for >, &amp; for &, &quot; for double quotes, and &apos; for single quotes. These five characters require encoding in HTML attribute values and text content.

What is the difference between HTML encoding and URL encoding? expand_more

HTML encoding converts characters to HTML entities for safe display within HTML documents. URL encoding converts characters to percent-encoded sequences for safe use within URLs. They are different formats for different contexts.

Does HTML encoding protect against XSS attacks? expand_more

Proper HTML encoding of user-supplied content before rendering it in a web page is one of the primary defences against cross-site scripting (XSS) attacks.

Can I encode special Unicode characters to HTML entities? expand_more

Yes. Unicode characters outside the basic ASCII range can be encoded as numeric HTML entities, for example &#169; for the copyright symbol or &#8364; for the euro sign.