HTML Entity Encoder/Decoder

Convert special characters (like < > & " ') to HTML entities online, or decode entities back to plain text. A developer's essential tool.

Quick Insert Common Symbols:

How to Use HTML Entity Encoder

  1. Enter your plain text (containing special characters) in the left box.
  2. The right box will automatically show the converted HTML entity codes.
  3. Alternatively, enter entity codes in the right box to decode them back to text on the left.
  4. Click the "Copy" button to instantly get the result.

When writing web pages (HTML), certain characters have special meanings. For example, the less-than sign < is used to define the start of a tag, and the greater-than sign > defines the end. If you want to display these characters themselves on a webpage instead of having the browser interpret them as code, you must use HTML Entities.

Furthermore, entity encoding is a key method for preventing XSS (Cross-Site Scripting) attacks. By converting user-inputted special characters into entities, malicious scripts are prevented from executing in the browser.

Common HTML Entities Reference

Character Description Entity Name Entity Number
  Non-breaking space &nbsp; &#160;
< Less than &lt; &#60;
> Greater than &gt; &#62;
& Ampersand &amp; &#38;
" Double quote &quot; &#34;
' Single quote &apos; &#39;
© Copyright &copy; &#169;
® Registered trademark &reg; &#174;

Frequently Asked Questions (FAQ)

What is an HTML Entity?
An HTML entity is a piece of text that begins with an ampersand (&) and ends with a semicolon (;). It is used to display reserved characters (like <) or invisible characters (like spaces) in HTML.
Why use HTML Entities?
Primarily to prevent the browser from misinterpreting characters. If you write < in HTML, the browser might think it's the start of a tag. Using &lt; tells the browser to display the character. It also helps prevent malicious code injection (XSS).
What does &nbsp; mean?
It stands for "Non-Breaking Space". Normal spaces in HTML are collapsed (multiple spaces become one) and allow line breaks. &nbsp; forces a space to appear and prevents automatic line breaking at that point.
Difference between Entity Name and Number?
Entity names (like &copy;) are easier to remember but not all are supported by every browser (though modern ones are good). Entity numbers (like &#169;) have better compatibility. For common characters, names are fine.
Do all Unicode characters have entity names?
No. Only a subset of commonly used Unicode characters have easy-to-remember names (like &euro;). However, all Unicode characters can be represented using entity numbers (like &#8364;).
Can I use HTML entities in CSS or JS?
You cannot use HTML entity format (like &copy;) directly. In JavaScript, use Unicode escape sequences (like \u00A9). In CSS, use the format \00A9. HTML entities are for HTML content only.
Does this tool support Emoji?
Yes. If you input Emoji (like 😀), this tool will convert them into their corresponding decimal entity numbers (&#128512;), ensuring they display correctly in all enviornments.
Do single quotes need to be escaped?
HTML5 allows unescaped single quotes if attributes are quoted with double quotes. However, if using single quotes in JS strings or attribute values, it's best to escape them as &apos; or &#39; to avoid errors.

More Free Tools