ToolNestr

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

Input: "<Hello>"
Encoded: "&lt;Hello&gt;" (< → &lt;, > → &gt;)

Most common HTML entities

Approximate usage frequency of HTML entities across the web.

&amp; (ampersand)40% of entities
&lt; (less-than)25%
&gt; (greater-than)20%
&quot; (double quote)10%
&copy; (copyright)5%
👩‍💻

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.

CharacterNamed EntityNumeric EntityDescription
&&amp;&#38;Ampersand
<&lt;&#60;Less-than
>&gt;&#62;Greater-than
"&quot;&#34;Double quote
'&apos; / &#39;&#39;Single quote / apostrophe
©&copy;&#169;Copyright
®&reg;&#174;Registered trademark
&trade;&#8482;Trademark
&euro;&#8364;Euro currency
£&pound;&#163;Pound currency
¥&yen;&#165;Yen currency
¢&cent;&#162;Cent currency
 &nbsp;&#160;Non-breaking space
°&deg;&#176;Degree symbol
±&plusmn;&#177;Plus-minus

How to use HTML Entity Converter

1

Paste your input

Type or paste the text containing special characters, or HTML entity codes you want to decode.

2

Choose action

Click Encode to turn special characters into HTML entities, or Decode to convert entities back to readable characters.

3

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 &lt; 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 &#8212;) 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 &copy; that are easy to remember but only exist for commonly used characters. Numeric entities use the character's Unicode code point, either in decimal (&#169;) or hexadecimal (&#xA9;) 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 &lt;script&gt;, 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, &lt; represents the less-than symbol (<) and &amp; 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 &amp; or &lt; that are easier to remember. Numeric entities use decimal or hexadecimal numbers like &#60; or &#x3C;. 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 &lt;, &gt;, &amp;, &quot;, &#39;, &copy;, &reg;, &nbsp;, &euro;, 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 &#39; vs &apos;?

&#39; is the numeric entity for the single quote (apostrophe) and is supported in all HTML versions. &apos; is the named entity but is not supported in HTML 4, so &#39; is the safer choice for broader compatibility.

Are HTML entities case-sensitive?

Yes. Entity names are case-sensitive. &copy; is the copyright symbol, while &COPY; 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 &nbsp; 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 &amp;.

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.

All tool categories

Converters (69 tools)
📊 CSV ↔ JSON Converter📄 JSON ↔ YAML Converter🔀 JSON ↔ XML Converter💿 Text ↔ Binary Converter🔢 Text ↔ Hex Converter🔗 URL Encoder / Decoder🏷️ HTML Entity Converter📡 Morse Code Converter💻 ASCII Code Converter🔤 Regex Escaper / Unescaper📄 GSM to mm Calculator💾 Data Storage Converter📡 Data Transfer Rate Converter⛽ Fuel Economy Converter📏 Feet & Inches Calculator📐 Inches to Fraction Calculator⚖️ Kg to Lbs Converter⚖️ Lbs to Kg Converter⚖️ Kg to Stone Converter⚖️ Stone to Kg Converter⚖️ Grams to Ounces Converter⚖️ Ounces to Grams Converter⚖️ Grams to Pounds Converter⚖️ Pounds to Grams Converter⚖️ Mg to Grams Converter⚖️ Metric Tons to Kg Converter📏 Cm to Inches Converter📏 Inches to Cm Converter📏 Cm to Feet Converter📏 Feet to Cm Converter📏 Mm to Inches Converter📏 Inches to Mm Converter📏 Meters to Feet Converter📏 Feet to Meters Converter📏 Km to Miles Converter📏 Miles to Km Converter📏 Yards to Meters Converter📏 Feet to Inches Converter📏 Inches to Feet Converter📏 Nautical Miles to Km Converter🌡️ Celsius to Fahrenheit Converter🌡️ Fahrenheit to Celsius Converter🌡️ Celsius to Kelvin Converter🌡️ Kelvin to Celsius Converter🧪 Liters to Gallons (US) Converter🧪 Gallons (US) to Liters Converter🧪 Ml to Fluid Ounces (US) Converter🧪 Fluid Ounces to Ml Converter🧪 Cups (US) to Ml Converter🧪 Quarts to Liters Converter🏎️ Mph to Km/h Converter🏎️ Km/h to Mph Converter🏎️ Knots to Mph Converter🔧 Psi to Bar Converter🔧 Bar to Psi Converter📏 Length Converter⚖️ Weight Converter📐 Area Converter🧪 Volume Converter🏎️ Speed Converter🔧 Pressure Converter⚡ Energy Converter🔌 Power Converter📐 Angle Converter🔢 Number to Words Converter🔢 Words to Numbers Converter➗ Decimal to Fraction Converter➗ Fraction to Decimal Converter🔬 Scientific Notation Converter
🌐 Networking & IP Tools (36 tools)
🧮 Everyday (26 tools)
💪 Health & Fitness (30 tools)
💰 Finance (34 tools)
🔢 Math (23 tools)
📄 PDF Tools (10 tools)
🎨 Creators (12 tools)
💻 Developers (24 tools)
⚡ Engineering & Science (24 tools)
⚛️ Physics (48 tools)
🧪 Chemistry (50 tools)
🧬 Biology (50 tools)
🏠 Construction & Home Improvement (105 tools)
👗 Clothing & Garment Tools (68 tools)
🍳 Cooking & Baking (9 tools)
🚗 Automotive (26 tools)
🖼️ Image Tools (13 tools)
🔐 Security & Hash (15 tools)
📝 Text Tools (15 tools)
🔍 SEO Tools (11 tools)
🕐 Time & Date (15 tools)
📊 Chart Generators (11 tools)
🕌 Islamic Tools (16 tools)