How to use the HTML Entity Encoder
- Choose Encode to escape text for HTML, or Decode to turn entities back into characters.
- Paste your text — the result updates as you type.
- When encoding, choose which characters to convert (only the HTML-special ones, or also accents, symbols and emoji) and the entity format: named, decimal or hex.
- Click Copy. Use Swap to run the result back through the opposite direction.
What are HTML entities?
HTML entities are escape sequences that represent characters which would otherwise be interpreted as markup, or which are hard to type. They start with & and end with ;, in three forms: named (©), decimal (©) and hexadecimal (©) — all three display ©. Encoding is essential whenever you show user-supplied text or code samples on a web page: without it, <script> in a comment would be executed instead of displayed.
The five characters you must escape
| Character | Entity | Why |
|---|---|---|
& | & | Starts every entity |
< | < | Starts a tag |
> | > | Ends a tag |
" | " | Ends a double-quoted attribute value |
' | ' | Ends a single-quoted attribute value (' is not defined in HTML 4) |
In normal text content, escaping & and < is enough; inside attribute values, quotes must be escaped too. The “Only HTML special characters” option does exactly this and leaves everything else readable — the right choice for UTF-8 pages, which is nearly all of them today.
Do you still need entities for accents and symbols?
If your page is served as UTF-8 (<meta charset="utf-8">), you can write é, € or emoji directly. Encoding all non-ASCII characters is still useful when content passes through systems that are not UTF-8-safe — legacy CMSs, some email templates, XML feeds or source files with an unknown encoding. Named entities exist only for a limited set (Latin-1, Greek letters, common math and typographic symbols); for everything else, such as emoji, numeric references are used: 😀 → 😀.
Useful entities to know
| Entity | Result | Use |
|---|---|---|
| (non-breaking space) | Keep “10 kg” on one line |
­ | (soft hyphen) | Optional hyphenation point in long words |
— / – | — / – | Dashes |
… | … | Ellipsis |
“ ” | “ ” | Typographic quotes |
€ © ™ | € © ™ | Symbols |
How decoding works
The decoder recognises all 2,231 named character references defined in the HTML Living Standard, plus decimal and hex references. It follows browser rules for edge cases: – becomes an en dash (Windows-1252 mapping) and invalid code points become �. Entity names are case-sensitive — É is É, é is é. For URLs use the URL Encoder instead, and for binary data Base64. Converting HTML to readable text? Try HTML to Markdown.
Tools that pair well with the HTML Entity Encoder
- HTML Formatter — Paste minified or messy markup and get clean, consistently indented HTML — including embedded <style> and <script> blocks.
- Markdown to HTML — Write or paste Markdown and get clean HTML instantly — with a sanitised live preview, GitHub-flavoured tables, task lists and fenced code blocks.
- JWT Decoder — Paste a JSON Web Token to inspect its header and payload, check when it expires and verify its signature.
- Hash Generator — Compute MD5 and SHA hashes of any text or file instantly, create HMAC signatures, and paste an expected checksum to verify a download.
Frequently asked questions
Which characters must be escaped in HTML?
& and < in text content, plus " (and ' if you use single quotes) inside attribute values. Escaping > is not strictly required but is conventional.Does HTML escaping prevent XSS?
<script> blocks, inline event handlers, CSS or href="javascript:…" URLs, which need context-specific handling.What is the difference between &nbsp; and a normal space?
are not collapsed into one like regular spaces are.Should I use named or numeric entities?
é are easier to read; numeric ones work for every Unicode character and in XML, which only predefines & < > " '.