Skip to main content
L
Loopaloo
Buy Us a Coffee
All ToolsImage ProcessingAudio ProcessingVideo ProcessingDocument & TextPDF ToolsCSV & Data AnalysisConverters & EncodersWeb ToolsMath & ScienceGames
Guides & BlogAboutContact
Buy Us a Coffee
L
Loopaloo

Free online tools for developers, designers, and content creators. Your files are processed in your browser and are never uploaded - no accounts required. A few network utilities (like What's My IP and Currency Converter) call public APIs to do their job and say so on their pages.

support@loopaloo.com

Tool Categories

  • Image Tools
  • Audio Tools
  • Video Tools
  • Document & Text
  • PDF Tools
  • CSV & Data
  • Converters
  • Web Tools
  • Math & Science
  • Games

Company

  • About Us
  • Contact
  • Blog
  • FAQ

Legal

  • Privacy Policy
  • Terms of Service
  • Disclaimer

Support

Buy Us a Coffee

© 2026 Loopaloo. All rights reserved. Built with privacy in mind.

Privacy|Terms|Disclaimer
  1. Home
  2. Web Tools
  3. HTML Entity Encoder/Decoder
Add to favorites

HTML Entity Encoder/Decoder

Encode and decode HTML entities exactly as browsers do: all 2,231 named references, decimal and hex, emoji, and the context rules for attributes.

Runs locally in your browserMore web toolsJump to full guide
Related readingHTML Entities and Special Characters: A Complete Reference for Web Developers10 min

Initializing in your browser…

You might also like

Favicon Generator

Create a favicon from text, an emoji or an image and download favicon.ico, every PNG size, a web manifest and the HTML tags in one zip.

Meta Tag Generator

Generate SEO, Open Graph and X card meta tags with safe escaping, checks for missing properties and broken images, and title previews for six platforms.

Password Generator

Make random passwords in one click, with the strength in bits calculated from the settings and the time each would take to guess.

HTML Entity Encoder/Decoder: a worked example

A log line arrives with HTML character references in it, and you need to know what it actually said, including whether something was escaped once or twice.

The line as it arrived

<p>Hello</p> then <escaped> then € then 😀
What HTML Entity Encoder/Decoder produces

Decoded once, with every reference accounted for

<p>Hello</p> then &lt;escaped&gt; then € then 😀

&lt;       at 0    <    U+003C
&gt;       at 5    >    U+003E
&lt;       at 14   <    U+003C
&gt;       at 20   >    U+003E
&amp;      at 30   &    U+0026
&amp;      at 45   &    U+0026
&#128;     at 59   €    U+20AC
  The standard remaps this one: &#128; is U+20AC (€), not the C1
  control at U+80. These references were written against windows-1252.
&#128512;  at 71   😀   U+1F600

The doubly escaped &amp;lt;escaped&amp;gt; comes back as the text &lt;escaped&gt;, not as a live tag, because a correct decoder makes one pass; one that keeps replacing would turn escaped text back into markup. &#128; is the euro sign, since browsers map references from 128 to 159 to the Windows characters old documents meant. And &#128512; is decoded as one emoji rather than as half of a surrogate pair. The positions are character offsets in the input, so each reference can be found in the original line.

About the HTML Entity Encoder

Escape text so it can go safely into HTML, or decode character references back into text exactly as a browser would. Every one of the 2,231 named references in the HTML standard is supported, along with decimal and hex references, the browser's special rules for old and attribute-value references, and emoji.

Key features

  • All 2,231 named references from the HTML standard
  • Named, decimal or hex output, with three levels of encoding
  • Decoding that follows the browser's own rules
  • Special handling of references 128 to 159 and of names without a semicolon
  • Element and attribute contexts
  • Emoji and other astral characters handled correctly
  • Every decoded reference listed with its position and code point
  • Reference lookup by name or character

How to use

  1. 1Choose Encode or Decode.
  2. 2For encoding, pick what to encode and how to write it; for decoding, say whether the text came from element content or an attribute.
  3. 3Type or paste your text; the result updates as you type.
  4. 4Read any notes under the output, and the list of decoded references.
  5. 5Copy the result, or Swap to send it back through the other way.

Escaping and unescaping HTML properly

Why escaping matters. In HTML, characters like < and & have meaning: < starts a tag and & starts a character reference. To show them as text, or to put user-supplied text into a page safely, they have to be written as references such as &lt; and &amp;. Getting this wrong breaks layouts at best and opens the door to cross-site scripting at worst.

Encoding. By default only the five characters that can change how markup is read are encoded: & < > " and '. That is all a modern UTF-8 page needs. You can also encode every character above ASCII, for content that has to pass through systems that mangle Unicode, or every character the standard has a name for. References can be written as names (&copy;), decimal (&#169;) or hex (&#xA9;); names fall back to numbers when a character has none. Emoji and other characters beyond the basic plane are encoded as a single reference, not as broken halves.

Decoding the way browsers do. The decoder follows the HTML standard's rules rather than a simple search and replace. It decodes once, so &amp;lt; becomes the text &lt; and never a live tag. It applies the special mapping for references between 128 and 159, which browsers read as Windows characters, so &#128; becomes the euro sign. And it knows the 106 old names that work without a semicolon, which behave differently in element text and in attribute values, so a link such as ?a=1&lt=2 keeps its query string.

Understanding the result. In decode mode every reference is listed with its position and code point, and anything unusual, such as double escaping or a reference that could not be resolved, is explained. The lookup panel finds any named reference by name or by pasting the character. Your text never leaves the browser and is not put into the page address; only the settings are, so a link shares them.

Examples

  • Showing code in a blog post

    Paste a snippet of HTML and encode it, so <div> appears on the page as text instead of becoming an element.

  • Reading an escaped log line

    Decode text from a log or database to see what it really says, and whether it was escaped once or twice.

  • A character you cannot type

    Search the lookup for "arrow" or "dash" and press a result to insert it or its reference.

Tips & best practices

  • Escape on output, at the moment text goes into HTML, rather than when you store it.
  • Use your template engine's escaping in production; use this tool to check and understand it.
  • If text shows &amp;amp;, it has been escaped twice; decode once to see the original.
  • Prefer the minimal setting on UTF-8 pages; it keeps the source readable.

Frequently asked questions

Which characters must be escaped in HTML?

In text and attribute values, & and < always, > by convention, and " or ' inside an attribute quoted with that character. The default setting escapes exactly these five.

Do I need to encode accented letters or symbols?

Not on a UTF-8 page, which is almost every page today. Encode them only when the text will pass through a system that cannot handle Unicode.

Why does &#128; decode to the euro sign?

The HTML standard maps references from 128 to 159 to the Windows-1252 characters they meant in old documents, so &#128; is €. Browsers do the same.

What happens with &amp;lt;?

It decodes once, to the text &lt;. A decoder that keeps replacing would turn it into a real < and could turn escaped text back into live markup.

Why does the context setting matter?

About a hundred old references, such as &lt and &copy, work without a semicolon in element text, but inside an attribute value they are left alone when followed by = or a letter or digit, which protects query strings in links.

Is my text sent anywhere?

No. Encoding and decoding happen in your browser, and the text is not stored in the page address.

Related tools and how they differ

  • URL Encoder/Decoder: Percent-encodes text for URLs, the other escaping you meet in links.
  • Base64 Encoder/Decoder: Encodes binary data as text, for data URLs and e-mail.
  • Meta Tag Generator: Writes head tags whose attribute values need the same escaping.

Further reading

  • HTML Entities and Special Characters: A Complete Reference for Web Developers10 min read

Private by design

This runs as client-side JavaScript. Keys, tokens, payloads, and other inputs never leave your device.