What are HTML entities?
HTML entities are codes that stand in for characters, written between an ampersand and a semicolon: < for <, & for &, € for €. They let you show characters that would otherwise be read as markup, and type symbols that aren't on your keyboard.
Developers encode user input before inserting it into a page, technical writers escape code samples so tags show instead of rendering, and email builders encode accented characters for older clients. Decoding goes the other way, which helps when an API, feed or database hands back text full of " and '.
How to use the HTML Entity Encoder
1.Paste text or HTML
Anything you want to show on a page as text, or a string full of entities.
2.Choose encode or decode
When encoding, pick which characters to escape and the entity style.
3.Copy the result
Paste it into your HTML, template or CMS.
Example: a price note with markup
Input: <p class="note">Fish & chips for £5 — "today" only</p>, encoding only the special characters with named entities:
- <p class="note">
- <p class="note">
- Fish & chips
- Fish & chips
- £5 —
- unchanged (only the five specials)
- With every non-ASCII too
- £5 —
Pasted into a page, the encoded version shows the tag as text instead of creating a paragraph.
Which characters need escaping
Five characters have special meaning in HTML: & starts an entity, < and > delimit tags, and " and ' close attribute values. Escaping just those is enough to display any text safely inside an element or a quoted attribute, and is the core defence against HTML injection.
Encoding every non-ASCII character as well is useful for old systems that mangle UTF-8, email templates, or source files that must stay pure ASCII. Named entities like © are easiest to read; numeric ones work for every character, including emoji.
Frequently asked questions
What's the difference between & and &?
Nothing in the browser: both produce &. One is the decimal code point, the other a named entity.
Does escaping stop XSS?
Escaping the five special characters prevents injected markup in element content and quoted attributes. JavaScript, URLs and CSS contexts need their own encoding.
Why is ' used instead of '?
' isn't defined in HTML 4, so ' works in every browser and email client.
Can it decode entities without a semicolon?
Yes. Decoding follows the browser's rules, which accept common legacy forms like & without the semicolon.
Related tools
URL Encoder & Decoder
Percent-encode or decode URLs and query values, and see a URL's parts.
Strip HTML Tags
Remove HTML tags and get clean, readable plain text.
Base64 Encoder & Decoder
Base64 and Base64url for text (UTF-8) and files.
JWT Decoder
Decode a JSON Web Token's header and payload and check its expiry.
Hash Generator: MD5, SHA-1, SHA-256
MD5, SHA-1 and SHA-256 hashes of text or files, with checksum compare.
Text to Binary Converter
Convert text to binary, hex, octal or decimal bytes, and back.
More Developer tools
JSON & data
CSV tools
Network & system
Web & API
Git & releases
Encoding & security
Text & code
- Regex tester
- Text diff checker
- Cron expression explainer
- Lorem ipsum generator
- Markdown previewer
- Slug generator
- Unicode character inspector
- URL parser
- Markdown TOC generator
- cURL converter
- Whitespace visualizer
- Markdown link extractor
- Regex escape
- Regex match extractor
- Split text by regex
- HTML, CSS and JS playground
- Mock data generator
- Keyboard event tester
- ASCII table