HTML Entity Converter

Encode and decode HTML entities

HTML Encoded

Enter input above

Common HTML Entities

&

&

<

&lt;

>

&gt;

"

&quot;

 

&nbsp;

space

©

&copy;

copyright

®

&reg;

registered

&trade;

trademark

°

&deg;

degree

&le;

less equal

&ge;

greater equal

&ne;

not equal

What is an HTML Entity Converter?

An HTML entity converter is a tool that translates special characters between their plain-text form and their corresponding HTML entity codes. HTML entities are special sequences of characters that represent reserved symbols, non-printable characters, or characters that are difficult to type directly in HTML source code. They ensure that web pages display correctly regardless of the browser, operating system, or character encoding being used.

HTML defines two syntaxes for entities: named entities and numeric entities. Named entities use a human-readable name preceded by an ampersand and followed by a semicolon, such as &lt; for the less-than symbol. Numeric entities use either decimal (&#60;) or hexadecimal (&#x3C;) codes to reference characters by their Unicode code point.

This converter supports both encoding (converting plain text to HTML entities) and decoding (converting HTML entities back to plain text). It handles the most commonly used named entities including &amp;, &lt;, &gt;, &quot;, and &nbsp;, as well as special symbols like copyright, trademark, and mathematical operators.

Common HTML Entities Reference

Understanding which characters require entity encoding is essential for writing valid HTML. The most critical entities are the five XML/HTML reserved characters that have special meaning in markup:

Character Entity Description
&&amp;Ampersand — must be escaped in all HTML
<&lt;Less-than sign — starts HTML tags
>&gt;Greater-than sign — ends HTML tags
"&quot;Quotation mark — used in attributes
'&#39;Apostrophe — used in single-quoted attributes

Beyond these essential entities, there are many others for special symbols like &copy; (copyright), &reg; (registered), &trade; (trademark), &deg; (degree), and mathematical operators like &plusmn;, &times;, and &divide;.

HTML Entity Formats

&amp;name; or &amp;#decimal; or &amp;#xhex;

Where:

  • name= The named entity (e.g., amp, lt, gt, quot)
  • decimal= The Unicode code point in decimal (e.g., #60 for <)
  • hex= The Unicode code point in hexadecimal (e.g., #x3C for <)

How to Use This Calculator

This converter provides bidirectional HTML entity encoding and decoding:

  1. Choose encode or decode mode: Click the "Encode" button to convert plain text to HTML entities, or click "Decode" to convert HTML entities back to plain text.
  2. Enter your text: Type or paste your text into the textarea. In encode mode, enter the text as it should appear. In decode mode, enter HTML entity codes.
  3. View the result: The output area immediately shows the converted text. Special characters are replaced with their entity equivalents (encode mode) or resolved back to characters (decode mode).
  4. Copy the result: Click the "Copy" button next to the output to copy the converted text to your clipboard for easy pasting into your HTML code.
  5. Reference the entity table: Below the converter, a grid of common HTML entities is displayed for quick reference and learning.

When to Use HTML Entities

HTML entities are necessary in several specific situations to ensure your web pages render correctly and validate properly:

Reserved characters in HTML: The characters &, <, >, and " have special meaning in HTML syntax. Using them literally in text content can break the parser or cause unexpected rendering. Always encode these characters as entities.

Non-breaking spaces: The &nbsp; entity creates a space that prevents line breaking at that point. This is useful for keeping words or phrases together on the same line, such as in product names, model numbers, or formatting requirements.

Special symbols: Characters like copyright (©), trademark (™), registered (®), degree (°), and mathematical symbols (±, ×, ÷) may not be available on all keyboards or may not display correctly without entity encoding. Named entities provide a reliable cross-platform solution.

Unknown character encodings: When you cannot guarantee the character encoding of the document (like UTF-8), using numeric entities ensures the characters display correctly regardless of encoding settings.

Real-World Applications

Web development and content management require HTML entity encoding whenever user-generated content is displayed. Without proper encoding, users could inadvertently (or maliciously) inject HTML that breaks page layout or creates security vulnerabilities like cross-site scripting (XSS).

SEO and structured data benefit from correct entity encoding. Search engines parse HTML more accurately when special characters are properly encoded, ensuring that product names, technical specifications, and legal text are indexed correctly.

Email templates and newsletters often require HTML entity encoding because email clients have inconsistent support for character encodings. Using entities ensures that special characters display correctly across Outlook, Gmail, Apple Mail, and other clients.

Worked Examples

Encoding Special Characters

Problem:

Encode the text '<script>alert("XSS")</script>' to prevent HTML injection.

Solution Steps:

  1. 1The < character becomes &amp;lt;
  2. 2The > character becomes &amp;gt;
  3. 3The " character becomes &amp;quot;
  4. 4Result: &amp;lt;script&amp;gt;alert(&amp;quot;XSS&amp;quot;)&amp;lt;/script&amp;gt;

Result:

The encoded string is safely displayed as text, not executed as code

Decoding HTML Entities

Problem:

Decode 'Tom &amp; Jerry &amp;#8212; The Movie' back to plain text.

Solution Steps:

  1. 1&amp;amp; decodes to &amp;
  2. 2&amp;#8212; is the decimal entity for the em dash character (—)
  3. 3Combine the decoded parts: Tom &amp; Jerry — The Movie

Result:

Tom &amp; Jerry — The Movie

Non-Breaking Space Usage

Problem:

Use entities to display 'Dr. Smith' without a line break between Dr. and Smith.

Solution Steps:

  1. 1Replace the space between Dr. and Smith with &amp;nbsp;
  2. 2Result: Dr.&amp;nbsp;Smith
  3. 3The browser renders this as 'Dr. Smith' but never breaks the line at this space

Result:

Dr.&amp;nbsp;Smith ensures the title and name stay together

Tips & Best Practices

  • Always encode &amp;, &lt;, &gt;, and &quot; in HTML content to prevent parsing errors
  • Use &amp;nbsp; to prevent line breaks between words that should stay together
  • The copyright symbol is &amp;copy; and the trademark symbol is &amp;trade;
  • Named entities are easier to read but numeric entities work for any Unicode character
  • When in doubt, encode it — entities never break valid HTML
  • Use UTF-8 encoding in your HTML documents to minimize the need for entities

Frequently Asked Questions

You must use HTML entities for the five reserved characters: &amp; (&amp;amp;), &lt; (&amp;lt;), &gt; (&amp;gt;), &quot; (&amp;quot;), and ' (&amp;#39;). These characters have special meaning in HTML syntax and will break your markup if used literally. Additionally, use entities for special symbols like ©, ™, ®, and non-breaking spaces.
Named entities use human-readable names like &amp;lt; for less-than, while numeric entities use the Unicode code point like &amp;#60; (decimal) or &amp;#x3C; (hexadecimal). Named entities are easier to remember, but numeric entities can represent any Unicode character, including those without named equivalents.
No, only the five reserved XML/HTML characters (&amp;, &lt;, &gt;, &quot;, ') must always be encoded. Other characters like accented letters and symbols can be used directly if your document uses UTF-8 encoding. However, encoding them as entities ensures compatibility with older systems that may not support UTF-8.
&amp;nbsp; stands for non-breaking space. Unlike a regular space, it prevents the browser from breaking the line at that point. It is commonly used to keep words or phrases together on the same line, such as in brand names (e.g., Dr.&amp;nbsp;Smith), model numbers, or where typographic formatting requires.
Yes, numeric entities can represent any Unicode character. The format &amp;#decimal; uses the decimal Unicode code point, and &amp;#xhex; uses hexadecimal. For example, &amp;#x1F600; represents the grinning face emoji. This makes numeric entities extremely versatile for including any character in HTML.

Sources & References

Last updated: 2026-06-06

💡

Help us improve!

How would you rate the HTML Entity Converter?

<>

Editorial Note

MyCalcBuddy Editorial Team

This page is maintained as an educational calculator reference.

Source

Formula Source: NIST Guide to SI Units

by National Institute of Standards

UpdatedLast reviewed: May 2026
CheckedFormula checks are based on standard references and internal QA review.