HTML Entity Encoder & Decoder
Use this HTML entity encoder to escape special characters like <, >, & and quotes so they display as text in HTML, or decode HTML entities back to plain characters.
By DevCalcHub Editorial Team · Last updated:
How it works
Encoding replaces characters that have special meaning in HTML (&, <, >, ", ') with their named entity equivalents so they display as literal text rather than being interpreted as markup.
Decoding reverses this, supporting both named entities (&) and numeric entities (& or &).
Example
Encoding a string with HTML-significant characters:
How to use the HTML entity encoder
- Paste your text or HTML.
- Choose Encode to escape &, <, >, " and ', or Decode to turn entities back into characters.
- Copy the output into your HTML.
When decoding, the tool supports &, <, >, ", ', ' and by name, plus any numeric entity such as © or ₹.
Common HTML entities
| Character | Named entity | Numeric entity |
|---|---|---|
| & | & | & |
| < | < | < |
| > | > | > |
| " | " | " |
| ' | ' | ' |
| Non-breaking space | |   |
| © | © | © |
| ® | ® | ® |
| ™ | ™ | ™ |
| ₹ (Indian rupee) | — | ₹ |
| € | € | € |
| — (em dash) | — | — |
When you need to escape HTML
- Showing code samples on a web page — otherwise the browser renders the tags instead of showing them.
- Inserting user-provided text into HTML, as a basic defence against HTML and script injection (XSS).
- Putting quotes inside HTML attribute values.
Modern frameworks such as React escape text automatically, so you mostly need this for templates, emails and static HTML. To make text safe inside a URL instead, use the URL Encoder.
Frequently asked questions
Why do I need to encode HTML entities?
If you're inserting user-provided or special-character text into HTML, encoding prevents characters like < and > from being misinterpreted as tags — which both breaks your page's structure and, in dynamic contexts, is a basic defense against HTML/script injection.
What's the difference between named and numeric entities?
Named entities like & are more readable; numeric entities like & or & represent a character by its Unicode code point and can encode any character, not just the handful with dedicated names.
What is ?
is a non-breaking space — a space that browsers won't collapse or break a line at. It is useful for keeping things like "10 km" or "₹ 500" together on one line.
What is the HTML code for the rupee symbol?
There is no named entity for ₹; use the numeric entity ₹ (or ₹), or simply type ₹ in a UTF-8 page.
What is the difference between HTML encoding and URL encoding?
HTML encoding makes characters safe to display inside HTML (for example < becomes <). URL encoding makes characters safe inside a URL (for example a space becomes %20). They are used in different places and are not interchangeable.
Related tools
Input
Output
<p class="example">Tom & Jerry's "great" day</p>