HTML Entity Encoder & Decoder

Encode and decode HTML special characters and entities. Converts to named (©), decimal (©).

Source Text

47 characters 47 bytes

Encoded HTML Entities

0 characters 0 entities created

⚖️ Decision Verdict: XSS-Safe HTML String

All HTML reserved delimiters (<, >, &, ") have been safely escaped into standard named entities, preventing DOM Cross-Site Scripting (XSS).

Character Encoding Telemetry

Entities Converted
8 Entities
Reserved delimiters & special symbols
Encoding Overhead
+34 Bytes
+72.3% payload size expansion
Security Sanitization
Safe
Zero unescaped HTML tag brackets
Format Type Named Entity W3C HTML5 standard
Source Length 47 Chars Input text size
Encoded Length 81 Chars Output text size
Encoding Standard UTF-8 / ISO 8859 Standard web encoding

Essential HTML Entities Reference Cheatsheet

Char Description Named Entity Decimal Hexadecimal
<Less Than (Tag Open)&lt;&#60;&#x3C;
>Greater Than (Tag Close)&gt;&#62;&#x3E;
&Ampersand&amp;&#38;&#x26;
"Double Quotation&quot;&#34;&#x22;
'Single Apostrophe&#39;&#39;&#x27;
©Copyright Symbol&copy;&#169;&#xA9;
€Euro Sign&euro;&#8364;&#x20AC;
£Pound Sterling&pound;&#163;&#xA3;

About this tool

How to use it

  1. Select your operation: Encode text to HTML entities, or Decode entities back to plain text.
  2. For encoding, choose your entity format: Named (&copy;), Decimal (&#169;), or Hexadecimal (&#xA9;).
  3. Type or paste your text or HTML code snippet into the source editor.
  4. View instant converted output with live character, byte, and entity count telemetry.
  5. Click 'Copy Output' to paste sanitized code directly into your markup or database.

Why it matters

In web development and content management systems (WordPress, Drupal, headless CMS), characters like <, >, &, and quotes have syntactical meaning in HTML. If rendered unescaped in user-generated content, they trigger browser rendering errors or lethal Cross-Site Scripting (XSS) injection attacks. Escaping them into entities guarantees safe, cross-browser rendering.

When to use it

Use this tool when displaying raw code blocks in markdown/HTML, sanitizing database outputs, fixing broken character encoding artifacts, or bypassing email client parsing bugs.

Good to know

Security Notice: HTML entity encoding is the primary defense against Stored and Reflected XSS when injecting untrusted strings into HTML body contexts.

Common questions

What is an HTML entity?

An HTML entity is a piece of text (starting with an ampersand '&' and ending with a semicolon ';') used to display reserved HTML characters (like '<' and '>') or invisible/special characters (like non-breaking spaces '&nbsp;' and copyright '©') that cannot be directly typed.

What are the five essential XML/HTML predefined entities?

The five core XML/HTML entities are: `&quot;` for double quote ("), `&amp;` for ampersand (&), `&#39;` (or `&apos;`) for single quote ('), `&lt;` for less-than (<), and `&gt;` for greater-than (>).

What is the difference between named and numeric entities?

Named entities use human-memorable text aliases (e.g. `&copy;`), but are only recognized in HTML documents. Numeric entities reference the character's exact Unicode code point in decimal (`&#169;`) or hexadecimal (`&#xA9;`), and are universally supported in both HTML and XML.

Does HTML entity encoding protect against XSS?

Encoding `<` and `>` into `&lt;` and `&gt;` neutralizes malicious `<script>` tags by forcing the web browser to treat them as harmless text strings rather than executable DOM instructions.

Why do some entities appear as strange symbols on my page?

When a page lacks a `<meta charset='utf-8'>` declaration or undergoes multiple incorrect encode/decode cycles (known as 'mojibake'), characters like '©' can turn into garbled strings like '©'. Using numeric HTML entities avoids encoding mismatch issues.