HTML Entity Converter
Encode and decode HTML entities
HTML Encoded
Enter input above
Common HTML Entities
&
&
<
<
>
>
"
"
space
©
©
copyright
®
®
registered
™
™
trademark
°
°
degree
≤
≤
less equal
≥
≥
greater equal
≠
≠
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 < for the less-than symbol. Numeric entities use either decimal (<) or hexadecimal (<) 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 &, <, >, ", and , 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 |
|---|---|---|
| & | & | Ampersand — must be escaped in all HTML |
| < | < | Less-than sign — starts HTML tags |
| > | > | Greater-than sign — ends HTML tags |
| " | " | Quotation mark — used in attributes |
| ' | ' | Apostrophe — used in single-quoted attributes |
Beyond these essential entities, there are many others for special symbols like © (copyright), ® (registered), ™ (trademark), ° (degree), and mathematical operators like ±, ×, and ÷.
HTML Entity Formats
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:
- 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.
- 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.
- 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).
- 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.
- 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 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:
- 1The < character becomes &lt;
- 2The > character becomes &gt;
- 3The " character becomes &quot;
- 4Result: &lt;script&gt;alert(&quot;XSS&quot;)&lt;/script&gt;
Result:
The encoded string is safely displayed as text, not executed as code
Decoding HTML Entities
Problem:
Decode 'Tom & Jerry &#8212; The Movie' back to plain text.
Solution Steps:
- 1&amp; decodes to &
- 2&#8212; is the decimal entity for the em dash character (—)
- 3Combine the decoded parts: Tom & Jerry — The Movie
Result:
Tom & Jerry — The Movie
Non-Breaking Space Usage
Problem:
Use entities to display 'Dr. Smith' without a line break between Dr. and Smith.
Solution Steps:
- 1Replace the space between Dr. and Smith with &nbsp;
- 2Result: Dr.&nbsp;Smith
- 3The browser renders this as 'Dr. Smith' but never breaks the line at this space
Result:
Dr.&nbsp;Smith ensures the title and name stay together
Tips & Best Practices
- ✓Always encode &, <, >, and " in HTML content to prevent parsing errors
- ✓Use &nbsp; to prevent line breaks between words that should stay together
- ✓The copyright symbol is &copy; and the trademark symbol is &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
Sources & References
- W3C - HTML Entities (2024)
- MDN Web Docs - HTML Entities (2024)
- W3Schools - HTML Entities (2024)
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.
Formula Source: NIST Guide to SI Units
by National Institute of Standards