HTML Entity Encoder & Decoder

This tool converts text to and from HTML entities

Updated
Loading toolโ€ฆ

This tool converts text to and from HTML entities

How to use HTML Entity Encoder & Decoder

  1. Choose Encode to turn text into entities, or Decode to turn entities back into text.
  2. When encoding, pick the entity type (named, decimal, or hex) and whether to escape only HTML-unsafe characters or all non-ASCII too.
  3. Paste your text, then click Copy output to grab the result.
Try next โ†’Env to JSON ConverterThis tool converts the contents of a .env (dotenv) file into a JSON object

About HTML Entity Encoder & Decoder

This tool converts text to and from HTML entities. In encode mode it escapes the five characters that break or expose your markup (&, <, >, double quote, and apostrophe), and can optionally escape every non-ASCII character too, so accented letters, symbols, and emoji stay safe no matter what character encoding a page uses. You choose whether entities come out as named (&copy;), decimal (&#169;), or hexadecimal (&#x2122;). In decode mode it turns entities back into plain characters, understanding decimal and hex numeric references plus the common named entities.

Everything runs locally in your browser using JavaScript. Nothing you type is uploaded, logged, or sent to a server, so it is safe for code snippets, config values, and internal content. Characters are processed by Unicode code point, which means multi-byte characters and emoji encode and decode correctly rather than being split apart.

One honest limit: the named-entity dictionary covers the escaping essentials and a few dozen everyday symbols, not the full HTML5 list of 2,000+ named entities. Anything outside that set is still handled correctly through numeric encoding, and unknown named entities are left untouched on decode rather than being mangled.

Frequently asked questions

What is the difference between named, decimal, and hex entities?
They all represent the same character. Named entities like &copy; are human-readable but limited to a fixed dictionary. Decimal (&#169;) and hexadecimal (&#xA9;) numeric entities can represent any Unicode character and are universally supported, which makes them the safest choice for symbols and emoji.
Which characters actually need to be encoded in HTML?
Only five are strictly unsafe: & < > and, inside attributes, the double and single quotes. The 'Only HTML-unsafe' scope escapes exactly those. Use 'All non-ASCII too' when you also want accented letters, symbols, and emoji converted for maximum compatibility across character encodings.
Is my text sent anywhere?
No. All encoding and decoding happens in your browser with JavaScript. There are no network requests, uploads, or tracking, so it is safe to paste code, config, or private content.
Does it handle emoji and other multi-byte characters?
Yes. Text is processed by Unicode code point, so emoji and other astral-plane characters are encoded to a single correct numeric entity and decoded back without being broken into surrogate halves.
Can it decode entities that were made somewhere else?
Yes. Decode mode reads decimal entities (&#38;), hex entities (&#x26;), and common named entities (&, &copy;, &mdash; and more). Unknown named entities are left as-is instead of being guessed.
Why does &apos; come out as ' when I encode?
The named entity &apos; is not valid in HTML 4 and older email clients, while the numeric ' works everywhere. To keep output safe in every context, apostrophes are encoded as ' even in named mode.