HTML Entity Encoder / Decoder

Updated July 2026

Convert text into safe HTML entities, or turn entities back into plain characters. Switch between Encode and Decode, paste your text, and copy the result. Everything runs privately in your browser.

HTML entities let you show reserved characters as text — for example < becomes &lt;, > becomes &gt;, & becomes &amp;, and " becomes &quot;. Paste text to encode it for safe HTML, or paste entities to decode them back.

How HTML entity encoding works

A web browser parses some characters as markup. A less-than sign starts a tag, an ampersand starts an entity, and quotes delimit attribute values. If you want those characters to appear as literal text — say, to show example code — you must escape them by replacing each one with its HTML entity.

The five reserved characters and their safe forms are: &&amp;, <&lt;, >&gt;, "&quot;, and '&#39;. The ampersand is always escaped first, otherwise the ampersands inside the other entities would themselves be re-encoded into &amp;lt; and the output would be wrong.

Worked example: the snippet <a href="x">Tom & Jerry</a> encodes to &lt;a href=&quot;x&quot;&gt;Tom &amp; Jerry&lt;/a&gt;. Pasted into a page, that displays the tag literally instead of rendering a link. Decoding the same string reverses every step and returns the original line.

Decoding does the opposite: it scans for entities and replaces them. Named entities like &copy; map to a fixed character (©), while numeric entities reference a code point in decimal (&#169;) or hexadecimal (&#xA9;). This tool decodes a common set of named entities plus all numeric references, without injecting your input as live HTML.

Common characters and their entities

CharacterNameNamed entityNumeric (dec)Numeric (hex)
&Ampersand&amp;&#38;&#x26;
<Less-than&lt;&#60;&#x3C;
>Greater-than&gt;&#62;&#x3E;
"Double quote&quot;&#34;&#x22;
'Apostrophe&apos;&#39;&#x27;
 Non-breaking space&nbsp;&#160;&#xA0;
©Copyright&copy;&#169;&#xA9;
®Registered&reg;&#174;&#xAE;
Euro&euro;&#8364;&#x20AC;
£Pound&pound;&#163;&#xA3;
Em dash&mdash;&#8212;&#x2014;
Ellipsis&hellip;&#8230;&#x2026;

Reference note: encoding always escapes the five reserved characters. With "encode all non-ASCII" enabled, every character above code point 127 is emitted as a decimal numeric entity, which is the most portable form for older systems and email.

Frequently asked questions

What are HTML entities?
HTML entities are short codes that represent characters which would otherwise be reserved or hard to type in HTML. They start with an ampersand and end with a semicolon, like &lt; for the less-than sign, and let you show a character as text instead of having the browser treat it as markup.
How do I escape HTML special characters?
Replace each reserved character with its entity: &&amp;, <&lt;, >&gt;, "&quot;, '&#39;. Escape the ampersand first so the others are not double-encoded. The encoder above does this for you.
What is &amp; / &lt; / &gt;?
&amp; is the entity for an ampersand (&), &lt; is the less-than sign (<), and &gt; is the greater-than sign (>). These three, plus &quot; and &#39;, cover the characters that break HTML if left raw.
When do I need to encode HTML?
Encode when you want to display code or symbols literally — for example showing an example <div> tag in a tutorial — and whenever you insert untrusted text into a page, so reserved characters cannot break the markup or open a security hole.
How do I decode HTML entities?
Switch the tool to Decode mode and paste text containing entities. It converts named entities such as &amp; and numeric references such as &#169; or &#xA9; back into their original characters.
What's the difference between named and numeric entities?
Named entities use a memorable label, like &copy; for ©. Numeric entities use the character's code point in decimal (&#169;) or hexadecimal (&#xA9;). Numeric entities work for any character; named entities only exist for a defined set.
⚡ HTML Entity Encoder / Decoder — by larely ↗

Related tools

Text to Speech Reader

Read any text aloud with your browser's built-in voices.

Regex Tester

Test and debug regular expressions live, with match highlighting and groups.

Cron Expression Generator

Build, explain and preview cron schedules with their next run times.

Aspect Ratio Calculator

Resize dimensions proportionally and simplify resolutions to a ratio.

Markdown Preview

Live Markdown-to-HTML preview with copyable HTML output.

Subnet Calculator

IPv4 CIDR subnet calculator: network, broadcast, mask and host range.

PX to REM Converter

Convert between px, rem, em and pt for CSS at any base font size.

Hash Generator

Generate SHA-256, SHA-1, SHA-384 and SHA-512 hashes in your browser.

JWT Decoder

Decode a JSON Web Token's header and payload .

Sort Text Lines

Sort, deduplicate, reverse, shuffle and clean a list of lines.

JSON to CSV Converter

Convert a JSON array to CSV and CSV back to JSON.

URL Encoder / Decoder

Percent-encode and decode text, and parse a URL into its parts.

Browse all 251 free tools →