HTML Entity Converter
Paste text to encode special characters to HTML entities (like © to copyright sign), or paste entity-encoded text to decode.
Reviewed by the ToolNestr Editorial Team — July 2026
How HTML entity conversion works
HTML entity conversion replaces special characters with their corresponding entity codes. Each entity starts with an ampersand (&) and ends with a semicolon (;). Named entities use descriptive names like < for the less-than sign, while numeric entities use the character's Unicode code point in decimal (<) or hexadecimal (<) format.
The encoder maps each character in the input to its HTML entity equivalent. The decoder does the reverse — it scans the text for entity patterns and replaces them with the actual characters. The tool also shows an analysis of which characters were encoded or decoded, helping you verify the output.
Worked example
Most common HTML entities
Approximate usage frequency of HTML entities across the web.
Elena Vasquez
Web developer who encodes user-generated content before rendering it in HTML templates to prevent XSS attacks and broken layouts.
Michael Chang
Content manager who pastes articles with special characters into the CMS and needs to ensure proper entity encoding for consistent display.
Olivia Bennett
Blogger who writes posts containing code snippets and needs to encode < > characters so they display correctly without being interpreted as HTML.
Daniel Foster
Email designer who encodes special characters in HTML email templates to ensure consistent rendering across email clients like Outlook and Gmail.
| Character | Named Entity | Numeric Entity | Description |
|---|---|---|---|
| & | & | & | Ampersand |
| < | < | < | Less-than |
| > | > | > | Greater-than |
| " | " | " | Double quote |
| ' | ' / ' | ' | Single quote / apostrophe |
| © | © | © | Copyright |
| ® | ® | ® | Registered trademark |
| ™ | ™ | ™ | Trademark |
| € | € | € | Euro currency |
| £ | £ | £ | Pound currency |
| ¥ | ¥ | ¥ | Yen currency |
| ¢ | ¢ | ¢ | Cent currency |
| |   | Non-breaking space | |
| ° | ° | ° | Degree symbol |
| ± | ± | ± | Plus-minus |
How to use HTML Entity Converter
Paste your input
Type or paste the text containing special characters, or HTML entity codes you want to decode.
Choose action
Click Encode to turn special characters into HTML entities, or Decode to convert entities back to readable characters.
Copy & use
Copy the result and paste it directly into your HTML, CMS, or email template. The tool shows which characters were converted.
Tips for HTML entities
Always encode & first
When encoding text, always encode ampersands first to avoid double-encoding other entities. An ampersand that is encoded later could turn < into < inadvertently.
Use numeric entities for rare characters
Named entities exist for the most common special characters. For less common characters, using the decimal or hexadecimal numeric format (like —) guarantees browser support regardless of encoding.
Decode before processing
If you receive entity-encoded text and need to process it programmatically, always decode it first. Operations like counting characters, searching, or truncating will be incorrect if the text contains encoded entities.
What are HTML entities?
HTML entities are special codes that represent characters that either have special meaning in HTML or are not easily typed on a keyboard. They always start with an ampersand (&) and end with a semicolon (;). Entities allow you to display reserved characters like < and > in your content without the browser interpreting them as HTML tags.
Why encode HTML?
Without HTML encoding, special characters can break your web pages. A single unencoded less-than sign could be interpreted as the start of an HTML tag, hiding the rest of your content. Encoding also protects against XSS attacks, where malicious users inject scripts through input fields. By encoding all user-generated content before rendering, you ensure it displays as plain text.
Named vs numeric entities
Named entities use descriptive names like © that are easy to remember but only exist for commonly used characters. Numeric entities use the character's Unicode code point, either in decimal (©) or hexadecimal (©) format, and work for any Unicode character. Numeric entities are more universal but less readable in source code.
XSS prevention
Cross-site scripting (XSS) is one of the most common web security vulnerabilities. Attackers inject malicious scripts through user input fields, comments, or URLs. HTML entity encoding is a primary defense — by converting <script> to <script>, the browser renders the text harmlessly instead of executing it. Always encode output, especially when displaying user-submitted content.
Frequently asked questions
What are HTML entities?
HTML entities are codes that represent special characters in HTML. They always start with & and end with ;. For example, < represents the less-than symbol (<) and & represents the ampersand (&).
Why should I encode HTML characters?
Encoding prevents special HTML characters from being interpreted as markup. Without encoding, a < in your content could be treated as the start of an HTML tag, breaking your page layout or creating security vulnerabilities.
What is the difference between named and numeric entities?
Named entities use descriptive names like & or < that are easier to remember. Numeric entities use decimal or hexadecimal numbers like < or <. Both render the same character, but named entities are more readable in source code.
Does this tool handle all HTML entities?
The tool handles the most common HTML entities including <, >, &, ", ', ©, ®, , €, and more. For less common entities, you can use the numeric format.
Can HTML entities prevent XSS attacks?
Yes. Cross-site scripting (XSS) attacks often inject HTML or JavaScript through user input. Encoding special characters like < > & " ' ensures user input is displayed as text instead of being executed as code.
When should I use ' vs '?
' is the numeric entity for the single quote (apostrophe) and is supported in all HTML versions. ' is the named entity but is not supported in HTML 4, so ' is the safer choice for broader compatibility.
Are HTML entities case-sensitive?
Yes. Entity names are case-sensitive. © is the copyright symbol, while © would not be recognized in most browsers. Always use lowercase entity names.
Do I need to encode spaces?
Regular spaces need no encoding. The non-breaking space entity is used only when you want to prevent line breaks between words, not for regular spacing.
Can I use HTML entities in email subjects?
No. HTML entities only work in HTML content. Email subjects and plain text emails do not parse HTML entities — they would display as literal text like &.
How do I display code examples on a web page?
Encode all < > and & characters in your code snippets so the browser displays them literally rather than interpreting them as HTML tags. Our converter makes this easy.