HTML Entity Encoder/Decoder
Escape special characters as HTML entities (named, decimal or hex) or decode any entity, using the full list of 2,231 HTML5 named references.
How to encode or decode HTML entities
- Paste your text or HTML in the input box.
- To escape it, choose the characters to encode: Only & < > " ' or Also every non-ASCII character, and pick an Entity format: Named (é), Decimal (é) or Hexadecimal (é).
- Click Encode, or click Decode to turn entities back into characters.
- Read the count in the status line, then click Copy. Use output as input moves the result to the input box, for example to check a round trip.
Encoding: when and what to escape
In HTML, five characters can be mistaken for markup. Only & < > " ' replaces exactly these: & with &, < with <, > with >, " with " and ' with '. This is what you need to show code on a web page, to put user text inside an attribute, or to paste a snippet into a blog post or a CMS field that expects HTML. The apostrophe uses the numeric form because ' did not exist in HTML 4 and some older parsers do not know it.
Also every non-ASCII character additionally replaces everything outside printable ASCII: accented letters, typographic quotes, the euro sign, non-breaking spaces, emoji and so on. The result is pure ASCII, which is useful for systems that mangle UTF-8, for e-mail templates, or to make invisible characters such as visible in the source.
The Entity format decides how characters are written:
- Named (é) uses a readable name when HTML defines one (
é,€,…), preferring the classic HTML 4 name when a character has several. Characters without a name, such as emoji, fall back to decimal. - Decimal (é) writes the Unicode code point in base 10.
- Hexadecimal (é) writes it in base 16, which matches the U+00E9 notation of Unicode charts.
All three are understood by every browser. Characters outside the Basic Multilingual Plane, such as 😀, are encoded as one reference to the full code point (😀), not as two surrogate halves.
Decoding: the HTML5 rules
Decode follows the rules that browsers use when they read text content, with the complete list of 2,231 named character references from the HTML Living Standard:
- named references such as
é,→or≂̸(some produce two code points); - decimal (
é) and hexadecimal (éoré) references, with or without the final semicolon; - legacy names that browsers accept without a semicolon, like
© 2026or&— and, as in browsers,¬it;becomes¬it;because¬is such a legacy name; - numeric references in the 128–159 range are mapped to the Windows-1252 characters browsers show (
–gives an en dash), and�, surrogates and values above U+10FFFF become the replacement character �.
Unknown names such as &foo; are left unchanged and counted in the status line. Decoding is done by the tool’s own parser, not by inserting your text into the page, so any markup or script in the input is never interpreted.
Frequently asked questions
Do I need to encode accented characters?
Usually not. A page served as UTF-8 can contain é or € directly. Encoding non-ASCII is only needed when the file or the system in between cannot handle UTF-8.
Why does &amp; decode to & and not to &?
Decoding is done once, like a browser does. &amp; is an escaped &. Click Use output as input and Decode again if the text was encoded twice.
What is the difference between this and URL encoding?
HTML entities escape text for HTML documents. URL encoding (%20, %C3%A9) escapes text for web addresses. Use the URL encoder for links and query strings.
Is my text sent to a server?
No. Encoding and decoding run in your browser. Only the list of entity names is loaded from this site when you first decode.
Does it decode entities inside attributes differently?
Browsers handle a few legacy names without a semicolon differently inside attribute values. This tool uses the text-content rules, which match what you see on the page.
Related tools
- URL Encoder and Decoder Free URL encoder and decoder. Percent-encode query parameters or full URLs, decode %XX sequences and handle + as space. Runs in your browser.
- HTML Formatter Beautify messy HTML with clean indentation, or minify it safely, in your browser. Inline CSS and JavaScript are formatted too. Nothing is uploaded.
- Base64 Encoder and Decoder Free Base64 encoder and decoder with full UTF-8 support and a URL-safe base64url option. Runs entirely in your browser, nothing is uploaded.