HTML Entity Encoder
Encode or decode HTML entities.
HTML entities let you display reserved characters safely — essential when showing code samples or user content in web pages.
How to use
- Paste text or HTML.
- Encode turns < > & into entities; Decode reverses it.
- Copy the result.
About this tool
Encoding prevents the browser from interpreting your text as markup.
Everything runs locally.
How it works
In HTML, < > & " and ' are syntax. To show them as text you write entities: &lt; &gt; &amp; &quot; &#39;. The browser renders &lt;div&gt; as the visible text <div> instead of creating an element.
Encoding user input before inserting it into a page is the basic defense against cross-site scripting (XSS). If a comment containing <script> is stored as &lt;script&gt;, the browser never executes it.
Named entities (&amp;) are the readable option; numeric ones (&#38; or &#x26;) can represent every Unicode character. Decoding reverses the process — handy when scraped pages arrive double-encoded.
Worked examples
Showing code in a blog post: To display <p>Hello</p> as text in your article, encode it to &lt;p&gt;Hello&lt;/p&gt; — otherwise the browser swallows it as a real paragraph element.
Fixing double-encoded text: Seeing &amp;amp; on a page means the text was encoded twice. Decode once to get &amp;, decode again to get &.
Quick reference
| Character | Named entity | Numeric |
|---|---|---|
| & | & | & |
| < | < | < |
| > | > | > |
| " | " | " |
| ' | ' | ' |
| (non-breaking space) | |   |
Frequently asked questions
When do I need entities?
When displaying <, > or & as text in HTML, or sanitizing user input for display.
What is &amp;?
The entity for an ampersand itself — entities can be nested.
Is my input uploaded?
No.
More free tools
UUID Generator
Generate random v4 UUIDs in bulk.
Base64 Encode / Decode
Encode text to Base64 or decode it back.
Color Converter (HEX ↔ RGB)
Convert HEX to RGB and back, with live preview.
JSON Formatter & Validator
Format, minify and validate JSON in one click.
What Is My IP
See your public IP address instantly. No sign-up, nothing stored.
URL Encoder / Decoder
Encode or decode URLs and query strings.