Database & Code

HTML Entity Encoder

Encode special characters to HTML entities and decode entities back to text — essential for safely displaying user content and reserved HTML characters.

Open Entity Encoder →
Looks like you're using an ad blocker. Devbin is free — ads help keep it running.

Common HTML Entities

CharNamed entityNumeric entityDescription
<&lt;&#60;Less-than sign (opens tags)
>&gt;&#62;Greater-than sign (closes tags)
&&amp;&#38;Ampersand (starts entities)
"&quot;&#34;Double quote (in HTML attributes)
'&apos;&#39;Single quote / apostrophe
 &nbsp;&#160;Non-breaking space
©&copy;&#169;Copyright symbol
&euro;&#8364;Euro sign

How to Use It

1

Open the tool

Go to Database & Code and scroll to the HTML Entity Encoder.

2

Paste your text

Paste the text or HTML you want to encode or decode.

3

Choose direction

Click Encode to replace <, >, & etc. with entities. Click Decode to reverse.

4

Copy the result

Copy the output and use it in your HTML template, email or documentation.

Pro Tips

💡Always encode user-provided content before inserting it into HTML — this is one of the most important XSS prevention measures.
💡In JavaScript: element.textContent = userInput is safe — the browser auto-encodes. Avoid innerHTML = userInput without encoding first.
💡In templates (React, Vue, Angular), use the framework's built-in escaping. Only use raw HTML interpolation (dangerouslySetInnerHTML, v-html) with sanitized content.

Frequently Asked Questions

What are HTML entities?
Codes representing characters with special HTML meaning or that can't be typed directly. &lt; renders as < without starting a tag.
Why encode HTML?
To prevent XSS attacks. If user input like <script>... is displayed without encoding, it can execute JavaScript in the browser.
Named vs numeric entities?
Both work identically. Named (&lt;) are more readable. Numeric (&#60;) work for any Unicode character. Hex (&#x3C;) uses hexadecimal.
Does encoding affect SEO?
No — search engines decode entities to the underlying character before indexing. &lt; and < are treated identically.

Encode HTML entities now

Open the HTML Entity Encoder and safely encode or decode special characters — free, instant, no login.

Open Entity Encoder →