HTML Entity Encoder / Decoder

Convert special characters to HTML entities and back

0 characters
0 characters

Common HTML Entities Reference

Click any entity to copy it to your clipboard.

CharacterDescriptionNamedNumeric
&Ampersand
<Less than
>Greater than
"Double quote
'Apostrophe
(space)Non-breaking space
©Copyright
®Registered
Trademark
Em dash
En dash
Left single quote
Right single quote
Left double quote
Right double quote
Bullet
Ellipsis
Right arrow
Left arrow
Up arrow
Down arrow
×Multiplication
÷Division
Not equal
Less or equal
Greater or equal
°Degree
±Plus-minus
¼One quarter
½One half

HTML Entity Encoder and Decoder

Encode and decode HTML entities quickly with our free online tool. Convert special characters to their named, numeric, or hexadecimal entity equivalents and back again. Ideal for sanitizing user input, preparing content for web pages, and debugging rendering issues caused by unescaped characters.

Features

  • Encode special characters to named HTML entities (e.g., &amp;, &lt;, &quot;)
  • Numeric (decimal) entity encoding for full Unicode coverage
  • Hexadecimal entity encoding option
  • One-click decode to convert entities back to their original characters
  • Built-in reference table of common HTML entities with search functionality
  • Batch encode or decode entire blocks of text at once
  • Real-time preview showing how the browser will render your encoded content
  • Copy encoded or decoded output to clipboard instantly

How to Use

  1. Paste or type your text into the input area.
  2. Choose the encoding mode: named entities, numeric (decimal), or hexadecimal.
  3. Click "Encode" to convert special characters into their HTML entity equivalents.
  4. To reverse the process, paste entity-encoded text and click "Decode" to restore the original characters.
  5. Use the reference table to look up specific entities by character or name.
  6. Copy the result from the output panel and use it in your HTML, templates, or database.

Use Cases

  • Web Development: Encode user-generated content before inserting it into HTML to prevent broken layouts and cross-site scripting vulnerabilities.
  • Email Templates: Ensure special characters like ampersands and angle brackets render correctly across email clients that handle raw HTML inconsistently.
  • CMS Content: Prepare article content that includes code snippets so that HTML tags display as text rather than being interpreted by the browser.
  • Data Migration: Clean up legacy database content that contains a mix of raw characters and partially encoded entities.
  • Accessibility: Verify that encoded content still reads correctly when consumed by screen readers and other assistive technologies.

FAQ

What is the difference between named, numeric, and hexadecimal entities?

Named entities use a human-readable keyword (e.g., &amp; for &), numeric entities use the character's Unicode code point in decimal (e.g., &#38;), and hexadecimal entities use the hex code point (e.g., &#x26;). Named entities are the most readable, but numeric and hex entities can represent any Unicode character, including those without a named alias.

Does encoding protect against XSS attacks?

Encoding special characters like <, >, ", and & is a fundamental defense against cross-site scripting (XSS). By converting these characters to entities, you prevent the browser from interpreting user-supplied input as executable HTML or JavaScript. However, encoding alone is not a complete security strategy and should be part of a broader input validation and sanitization approach.

Which characters need to be encoded in HTML?

At a minimum, you should encode & (ampersand), < (less than), > (greater than), " (double quote), and ' (single quote/apostrophe). These five characters have special meaning in HTML and can break your markup or introduce security vulnerabilities if left unescaped.