HTML Entity Encoder & Decoder
Encode the five HTML-significant characters (ampersand, less-than, greater-than, double-quote, and apostrophe) into entities for safe embedding, and decode any HTML entities back to plain text. Everything runs in your browser.
How to use this tool
- 1
Pick a mode with the Encode or Decode toggle at the top.
- 2
Paste or type your text into the input box.
- 3
Read the converted result in the output panel below, which updates as you type.
- 4
Select and copy the output to use in your HTML or document.
What does this HTML entity tool actually do?
HTML entities are escape sequences that stand in for characters the browser would otherwise treat as markup. In Encode mode this tool replaces exactly five characters: ampersand becomes &, less-than becomes <, greater-than becomes >, the double quote becomes ", and the apostrophe becomes the numeric reference '. Note it uses ' rather than the named ', because ' is not defined in HTML4 and can fail in older parsers. It does not touch accented letters, emoji, or other non-ASCII characters — on a UTF-8 page those render fine as-is, so they are intentionally left alone. Encode runs as a plain chain of string replacements, with the ampersand escaped first so existing entities are not double-mangled. Decode mode works differently: it assigns your input to a hidden textarea's innerHTML and reads back the decoded value, which means the browser's own parser resolves the entities. That covers the full set of named entities (©, , —) and numeric references (©, —), not just the five that Encode produces. Because decode relies on the live DOM, it only runs in the browser.
Common use cases
Pasting a code snippet into a blog post or docs so tags like <div> display literally instead of rendering.
Escaping user-supplied text before dropping it into an HTML template to avoid breaking the markup.
Decoding entity-laden strings copied from page source, RSS feeds, or scraped HTML back into readable text.
Turning a stray &nbsp; or &mdash; from a CMS export back into a normal space or em dash.
Preparing example strings for tutorials where you need to show the raw entity form of a character.
Quickly checking what ' or — decodes to without writing throwaway code.
Frequently asked questions
Which characters does Encode actually change?▼
Why does the apostrophe become ' instead of '?▼
Does Decode handle entities this tool can't produce?▼
Is this enough to prevent XSS?▼
Will encoding twice break my text?▼
Is my text uploaded anywhere?▼
Why does Decode need a browser?▼
Related tools
JWT Decoder
Decode JSON Web Tokens (JWT) instantly — inspect the header, payload, and signature claims. Runs entirely in your browser; tokens never leave your device. Safe for production secrets.
JSON Formatter & Validator
Format, validate, and minify JSON instantly. Catches syntax errors with line numbers, pretty-prints with adjustable indent, supports large payloads. Runs in your browser — no upload.
XML Formatter & Beautifier
Format and beautify XML documents — proper indentation, line breaks, namespace handling. Useful for SOAP responses, sitemaps, RSS feeds, and Android resource files.
Base64 Encoder & Decoder
Encode and decode Base64 strings.
URL Encoder & Decoder
Encode/decode URL-safe strings.
CSS Minifier
Minify CSS to reduce file size.