HTML encoder / decoder

Encode special characters to HTML entities or decode entities back to readable text. Instant results.

Text / HTML input
Encoded output
Common HTML entities reference
Send output to:

Ctrl + L clear  |  Ctrl + Shift + C copy output

What are HTML entities and why do they matter

HTML entities are special codes that represent characters which have meaning in HTML markup. The five most critical characters are the ampersand (&), less-than sign (<), greater-than sign (>), double quote ("), and single quote ('). These characters are used to define HTML tags and attributes, so when you want to display them as literal text rather than HTML syntax you must encode them as entities. Without encoding, a less-than sign could be interpreted as the start of an HTML tag and break your page layout.

When to encode HTML

Encode HTML whenever you are inserting text into an HTML document that might contain special characters. The most common scenarios are displaying user-generated content such as comments or form submissions, showing code snippets on a page, inserting data from a database into HTML, and generating HTML programmatically. Failing to encode user input is one of the most common sources of cross-site scripting (XSS) vulnerabilities — a security flaw where malicious users inject scripts into your page through unencoded input.

Named entities vs numeric entities

HTML entities can be written in two formats. Named entities use a descriptive name — &amp; for ampersand, &lt; for less-than, &copy; for the copyright symbol. Numeric entities use the Unicode code point — &#38; for ampersand, &#60; for less-than, &#169; for copyright. Named entities are more readable but not all characters have named versions. Numeric entities work for any Unicode character. Both formats produce identical results in the browser.

Decoding HTML entities

HTML decoding converts entities back to their original characters. This is useful when you receive HTML-encoded text from an API or database and need to display or process the plain text version. Switch to Decode mode and paste your encoded HTML — all entities including both named entities like &amp; and numeric entities like &#38; are converted back to their characters.

Frequently asked questions

What is HTML encoding?

HTML encoding converts special characters into HTML entities so they display correctly in browsers. The less-than sign becomes &lt; and the ampersand becomes &amp;. Without encoding these characters would be interpreted as HTML markup.

When do I need to encode HTML?

When displaying user-generated content, code snippets, or text containing special characters in a web page. Unencoded special characters can break HTML structure or create XSS security vulnerabilities.

What is the HTML entity for an ampersand?

The HTML entity for an ampersand is &amp;. Similarly < is &lt;, > is &gt;, double quotes are &quot;, and single quotes are &#39;.

What is the difference between HTML encoding and URL encoding?

HTML encoding converts characters to HTML entities for use inside HTML documents. URL encoding converts characters to percent-encoded format for use in URLs. Use HTML encoding for web page content and URL encoding for web addresses.

Does this tool encode all special characters?

By default it encodes the five critical HTML characters. Enable Encode all non-ASCII to also encode extended characters like accented letters, symbols, and emoji as numeric entities.