HTML Entity Converter
Encode text into HTML entities, in named (©), decimal (©) or hex
(©) form, or decode entities back into plain characters. Encoding works per Unicode code point, so an
emoji becomes one valid entity. Decoding uses the browser's HTML parser on an inert document, so it recognizes every named
entity in the HTML standard while any tags in the input stay as text and nothing in it can run.
How to use the HTML Entity Converter
- Paste text or HTML source into Input.
- To encode, pick a style and click Encode. Tick Encode all non-ASCII to turn every character above code point 127 into an entity as well, not just the five HTML specials.
- To decode, click Decode. Every entity is replaced by the character it stands for; anything else is left as it is.
The three styles produce different text for the same input. <a href="x">Tom & Jerry</a> in
Named style becomes <a href="x">Tom & Jerry</a>.
In named style the apostrophe is written ', because ' is not defined in HTML 4 and some old
parsers reject it. In hex style the same apostrophe is '.
Without the non-ASCII option, named style still converts the characters it has a short name for (for example
© 2026 becomes © 2026), while the numeric styles leave © alone. With the option,
decimal turns it into © 2026 and hex turns café into café.
When HTML entities are needed
An entity is a way to write a character using only ASCII: &, then a name or a number, then ;.
Browsers decode it before display, so < shows as <. Entities exist for two reasons.
1. Characters that HTML itself uses. These five must be escaped whenever untrusted text is placed into HTML. Getting this wrong is how most cross-site scripting bugs happen:
&→&(always, in text and in attributes)<→<(in text; it starts a tag)>→>(not strictly required, but escaped by convention)"→"(inside double-quoted attribute values)'→'(inside single-quoted attribute values)
Escaping is context-specific. These entities make text safe inside HTML text and quoted attributes, but not inside a
<script> block, a style attribute or a URL such as href="javascript:...". Those need
JavaScript, CSS or URL encoding instead.
2. Characters a channel cannot carry. If a system mangles non-ASCII text (an old email pipeline, a database
column with the wrong charset, a template engine reading Latin-1), numeric entities let café or €
survive as plain ASCII. With UTF-8 end to end, which is the norm today, this is rarely necessary.
Common use cases
- Showing code on a web page. Encode an HTML snippet so it displays as text inside
<pre><code>instead of rendering. - Reading escaped data. Decode HTML-escaped strings found in API responses, RSS feeds, scraped pages or database dumps.
- Debugging double encoding. When a page shows
&or<to users, decode once to see what the stored text really is. - ASCII-only channels. Turn accented letters, currency symbols and emoji into numeric entities for systems that cannot store UTF-8.
Decoding is one pass, and double encoding shows up
Decoding replaces each entity once, exactly as a browser does. <b> &amp; © © ©
decodes to <b> & © © ©. The &amp; became &, not &,
which is the sign of text that was escaped twice. Decode again only if you are sure the data was double-encoded.
Some inputs never decode to what they look like:
�and lone surrogate halves such as�are invalid code points. The HTML standard replaces them with U+FFFD, the replacement character (�).- An unknown name such as
&unknown;, or an ampersand that starts no entity, as inAT&T, is left as it is. - Emoji live above U+FFFF.
😀encodes to😀(decimal) or😀(hex). Encoders that walk a JavaScript string unit by unit produce��instead: two surrogate halves that browsers display as two replacement characters. This tool encodes per code point, so emoji survive a round trip.