ConvertText.app LogoConvertText.app

HTML Entity Encoder / Decoder

Decode and encode HTML entities online directly in your browser. This HTML entity decoder and encoder helps you unescape HTML, convert HTML entities to text, or encode special characters for safe display in HTML. It converts reserved characters such as `&`, `<`, `>`, `"`, and `'` into entity equivalents like `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;`, and decodes them back again. Extended mode can also convert accented letters, symbols, and emoji to numeric entities.

Paste normal text, escaped HTML, or an HTML-encoded string into the input, then choose whether to encode HTML or decode HTML back to readable text. It works as a simple HTML decode online tool, HTML encode online tool, and private browser-based helper for unescaping HTML entities. Everything runs locally in your browser — your text never leaves your device.

Conversion options
Pick whether you want to encode or decode, and choose the encoding detail level when encoding.

Encodes only the five reserved HTML characters: & < > " ' — accented letters and emoji pass through unchanged.

Text to encode
Enter the text you want to encode. Reserved characters become HTML entities.
0 chars
Encoded output
HTML-entity-encoded result, safe to embed in HTML source.
0 chars

🔒 Your text is processed in your browser. Nothing is uploaded.

This is a private, browser-based HTML entity decoder and encoder. It works as a simple HTML entities converter for developers, bloggers, CMS users, and students who need to decode HTML-encoded text, unescape HTML entities, or encode HTML characters safely. The tool uses pure JavaScript string iteration and a curated named-entity map to process text entirely on your device, with no server round-trip and no third-party libraries.

What are HTML entities?

An HTML entity is a short piece of text that represents a character in HTML source code. Entities are used when a character would be ambiguous or invalid in raw HTML — for example, the `<` and `>` characters delimit HTML tags, so a literal `<` in text content must be written as `&lt;` to prevent the browser from misinterpreting it as the start of a tag.

HTML entities come in two forms. Named entities use a human-readable name preceded by `&` and followed by `;`, for example `&amp;` for an ampersand, `&copy;` for a copyright sign, or `&mdash;` for an em dash. Numeric entities use a decimal or hexadecimal Unicode code point instead of a name — decimal `&#169;` and hex `&#xA9;` both produce the copyright sign ©.

The five reserved HTML characters have named entities every developer should know:

  • `&amp;` — the ampersand character `&`
  • `&lt;` — the less-than sign `<`
  • `&gt;` — the greater-than sign `>`
  • `&quot;` — the double-quote character `"`
  • `&#39;` — the apostrophe / single-quote character `'`

Beyond the reserved set, HTML also defines named entities for hundreds of characters including accented letters (`&eacute;` = e with acute accent), non-breaking spaces (`&nbsp;`), typographic punctuation (`&mdash;` = em dash, `&ldquo;` and `&rdquo;` = curly double quotes), currency symbols (`&euro;` = euro sign), mathematical symbols, and Greek letters.

When should I encode HTML entities?

Encode HTML entities whenever you are inserting plain text into an HTML document and that text might contain characters reserved by the HTML grammar. The most common scenarios are:

  • Pasting user-generated content or blog copy into a CMS or template where raw HTML is stored.
  • Embedding code examples in a blog post or documentation page — a snippet like `<strong>bold</strong>` must be encoded as `&lt;strong&gt;bold&lt;/strong&gt;` so the browser renders it as visible text rather than as a real HTML element.
  • Constructing JSON payloads that will be embedded inside HTML `<script>` tags, where `<`, `>`, and `&` can break the surrounding HTML structure.
  • Storing attribute values that may contain double quotes, to avoid breaking the surrounding `"..."` delimiters.
  • Encoding special characters for an HTML email template.

Use basic mode when you only need to escape the five reserved characters and want accented letters and emoji to remain readable. Use extended mode when you need maximum HTML compatibility or are working with a legacy system that only supports ASCII.

When should I decode HTML entities?

Decode HTML entities when you receive text that has already been escaped and you need to read, process, or display the original characters. In search terms, this is often called HTML decode, HTML unescape, htmldecode, or converting HTML encoded text to normal text. Common situations include:

  • Receiving API responses where string fields contain HTML-escaped text — for example `Tom &amp; Jerry` when you expected `Tom & Jerry`. In this case, you need to convert HTML entities to text.
  • Fixing double-encoded content where a CMS has escaped text that was already escaped, producing strings like `&amp;lt;` instead of `&lt;` or `<`.
  • Reading RSS or Atom feed entries where text content is typically HTML-encoded.
  • Inspecting log lines that contain HTML-escaped query parameters or error messages.
  • Copying visible text out of an HTML source file where the content is stored as entities.

This tool decodes both named entities (`&amp;`, `&copy;`, `&mdash;`, `&nbsp;`, and hundreds more) and numeric entities in both decimal (`&#169;`) and hexadecimal (`&#xA9;`) notation.

Basic mode vs extended mode

This encoder offers two levels of encoding detail.

Basic mode encodes only the five reserved HTML characters: `&` becomes `&amp;`, `<` becomes `&lt;`, `>` becomes `&gt;`, `"` becomes `&quot;`, `'` becomes `&#39;`. All other characters — including accented letters like `é` and `ü`, symbols like `©` and `—`, and emoji like 😀 — are passed through unchanged. Use basic mode when your target environment handles Unicode natively and you only need to prevent HTML parsing errors.

Extended mode encodes the same five reserved characters and additionally converts every non-ASCII character to a decimal numeric entity. For example, `é` becomes `&#233;`, `©` becomes `&#169;`, `—` becomes `&#8212;`, and 😀 becomes `&#128512;`. Use extended mode when you need a pure ASCII output or when working with tools or databases that do not handle multibyte characters reliably.

Developers sometimes search for the same task as `htmlDecode`, `htmlEncode`, HTML escape, HTML unescape, encode HTML, or decode HTML. The wording differs, but the goal is the same: safely convert between readable characters and their HTML entity representation.

Round-trip example in basic mode:

  • Input: `Café & © 😀`
  • Encoded (basic): `Café &amp; © 😀`
  • Decoded back: `Café & © 😀`

Round-trip example in extended mode:

  • Input: `Café & © 😀`
  • Encoded (extended): `Caf&#233; &amp; &#169; &#128512;`
  • Decoded back: `Café & © 😀`

HTML entity encoding vs URL encoding

HTML entity encoding and URL encoding are two completely different mechanisms that serve different purposes and produce different output. They are often confused because both transform special characters into an alternative representation.

HTML entity encoding is for HTML documents. It replaces characters that have a special meaning in HTML markup with entity sequences that the HTML parser treats as text content. The result is still readable text — `&amp;` visually renders as `&` in a browser.

URL encoding (percent encoding) is for URLs. It replaces characters that are unsafe or reserved in a URL with percent-encoded byte sequences. A space becomes `%20`, an ampersand becomes `%26`, a less-than sign becomes `%3C`.

Comparison of the same characters in both systems:

  • `&` — HTML: `&amp;`, URL: `%26`
  • `<` — HTML: `&lt;`, URL: `%3C`
  • `>` — HTML: `&gt;`, URL: `%3E`
  • `"` — HTML: `&quot;`, URL: `%22`
  • `'` — HTML: `&#39;`, URL: `%27`

If you paste HTML-encoded text into a URL encoder it will encode the entity characters themselves (the `&`, `;`, `#`), which is almost never what you want. Use each tool only for its intended context: HTML entities for HTML content, percent encoding for URLs.

Need to encode or decode a URL instead of HTML text? Use the URL Encoder / Decoder. Use this page for HTML entity decoding, HTML entity encoding, and converting HTML encoded text back to readable text.

HTML entity encoding vs HTML cleaning

HTML entity encoding (this tool) converts characters into their HTML entity equivalents and reverses the process. It does not add, remove, or reorder any HTML elements. The structure of the document is preserved; only the representation of special characters changes.

HTML cleaning is a different operation that strips or rewrites HTML markup — removing unwanted tags, normalising attributes, or sanitising potentially dangerous content. A cleaner might turn `<b onclick="...">bold</b>` into `<b>bold</b>` or just `bold`, depending on its rules.

This tool does not clean HTML. If you paste raw HTML into the encoder, it encodes the angle brackets and other reserved characters in the markup, turning `<p>Hello</p>` into `&lt;p&gt;Hello&lt;/p&gt;`. It does not inspect, remove, or restructure any element.

Similarly, this tool is not a text cleaner. It does not strip extra whitespace, remove diacritics, or normalise line endings. Its only job is to encode and decode HTML entities.

Frequently Asked Questions

What is an HTML entity decoder and encoder?

An HTML entity decoder turns escaped HTML entities such as `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` back into readable characters. An HTML entity encoder does the reverse: it converts text characters that have a special meaning in HTML — such as `&`, `<`, `>`, `"`, and `'` — into safe HTML entity sequences. This page works as both an HTML decode online tool and an HTML encode online tool, with basic and extended encoding options, all in your browser.

What are HTML entities?

HTML entities are special text sequences that represent characters in HTML source code. They begin with `&` and end with `;`. Named entities use a readable name such as `&amp;` (ampersand), `&lt;` (less-than), `&copy;` (copyright sign), or `&mdash;` (em dash). Numeric entities use a decimal or hexadecimal Unicode code point: `&#169;` and `&#xA9;` both produce the copyright sign ©. Entities exist because certain characters — especially `<`, `>`, and `&` — have reserved meanings in HTML markup and must be escaped to appear as literal text.

When should I encode HTML entities?

Encode HTML entities any time you are embedding plain text in an HTML document and that text might contain characters reserved by HTML. The most important cases are: displaying user-generated content on a web page, where escaping reserved HTML characters can help prevent text from being interpreted as markup, embedding code snippets in blog posts or documentation, constructing HTML email templates, and storing text in CMS fields where HTML is expected. Use basic mode for most web content; use extended mode when you need pure ASCII output or maximum compatibility with older systems.

When should I decode HTML entities?

Decode HTML entities when you receive HTML-escaped text and need the original characters back. Common situations include: API responses that return escaped strings such as `Tom &amp; Jerry`, double-encoded CMS content where `&amp;lt;` should really be `<`, RSS or Atom feed entries where text content is entity-encoded, and log lines containing escaped query parameters. This tool decodes both named entities and numeric entities (decimal and hexadecimal). You can also think of this as using an HTML unescape online tool, a browser-based htmldecode helper, or a way to convert HTML entities to text.

What does unescape HTML mean?

To unescape HTML means to decode HTML entities back into their original readable characters. For example, `&amp;` becomes `&`, `&lt;` becomes `<`, and `&gt;` becomes `>`. This is useful when copied text, API output, CMS content, or source code contains escaped HTML that you want to read as normal text.

What is htmldecode?

`htmldecode` is a developer-style way to describe decoding HTML entities back to normal text. In JavaScript, PHP, and other programming contexts, people often use names like htmlDecode, htmlEncode, HTML escape, and HTML unescape for the same kind of conversion. This tool lets you do that conversion online without writing code.

What is the difference between `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;`?

These are the five HTML entities for the reserved characters that have special meaning in HTML markup. `&amp;` represents the ampersand character `&`, which starts every HTML entity. `&lt;` represents the less-than sign `<`, which opens HTML tags. `&gt;` represents the greater-than sign `>`, which closes HTML tags. `&quot;` represents the double-quote character `"`, which delimits HTML attribute values. `&#39;` (or `&apos;` in HTML5) represents the apostrophe / single-quote character `'`, also used in attribute values. All five must be escaped wherever they appear as literal text content.

What is the difference between named and numeric HTML entities?

Named entities use a human-readable name such as `&amp;`, `&copy;`, or `&mdash;`. Numeric entities use a Unicode code point in decimal (`&#169;` for ©) or hexadecimal (`&#xA9;` for ©). Named entities are easier to read and write, but only a predefined set of names is standardised by HTML. Numeric entities can represent any valid Unicode character, including emoji and characters from any script, even if no named entity exists for them. Extended mode in this encoder uses decimal numeric entities for all non-ASCII characters.

Is HTML entity encoding the same as URL encoding?

No, they are completely different. HTML entity encoding replaces characters with entity sequences for use in HTML documents — for example `&` becomes `&amp;`. URL encoding (percent encoding) replaces characters with percent-encoded byte sequences for use in URLs — the same `&` becomes `%26`. Each scheme is only valid in its own context. Applying URL encoding to HTML-encoded text would encode the `&` and `;` of the entity itself, producing garbage. Always use the right tool for the right context. Use this page for HTML entity decoding, HTML entity encoding, and converting HTML encoded text back to readable text.

Is HTML entity encoding the same as HTML cleaning?

No. HTML entity encoding (this tool) converts characters to and from entity representation without adding, removing, or restructuring any HTML elements. HTML cleaning is a different operation that strips unwanted tags, sanitises attributes, or normalises markup. This tool does not inspect or modify HTML structure in any way — it only encodes and decodes the text representation of characters.

Does this tool render or execute HTML?

No. The decoded output is displayed as plain text inside a read-only text area. The tool never uses innerHTML, dangerouslySetInnerHTML, or any other mechanism that would cause the browser to parse or execute the output as HTML. For example, decoding `&lt;script&gt;alert(1)&lt;/script&gt;` produces the literal string `<script>alert(1)</script>` visible as text — the script is never executed and no script element is ever added to the DOM.

Is my text uploaded to a server?

No. The encoder and decoder run entirely in your browser using pure JavaScript. Your input is never sent to a server, never stored, and never logged. Closing the tab discards everything. That makes the tool safe for sensitive content such as API keys, internal HTML templates, or personal documents you would rather not paste into a remote service.

Explore More Text Tools

Free online tools to convert, encode, and transform your text

Convert Case

Transform text case — uppercase, lowercase, title case & more

Morse Code Translator

Convert text to Morse code and vice versa

Morse Code Audio Decoder

Decode Morse code from audio files or microphone

Binary Translator

Convert text to binary and vice versa

Base64 Encoder/Decoder

Encode and decode Base64 text

Hex Converter

Convert text to hexadecimal and vice versa

ROT13 Encoder/Decoder

Encode and decode text using ROT13 cipher

Superscript Generator

Convert text to Unicode superscript where supported

Subscript Generator

Convert text to Unicode subscript where supported

Strikethrough Text Generator

Generate copy-paste Unicode strikethrough text instantly

Image to Base64 Converter

Convert images to Base64 / Data URI

URL Encoder / Decoder

Encode and decode URL components, query strings, and percent-encoded text