DevsToolkit

HTML Entity Encode/Decode

Encoding

Encode special characters to HTML entities or decode HTML entities back to characters

All processing happens locally in your browser — your data never leaves your machine.
Loading tool...

Examples

Encode HTML Tags

Input
<div class="alert">Price: $5 & up</div>
Output
&lt;div class=&quot;alert&quot;&gt;Price: $5 &amp; up&lt;/div&gt;

Encode Non-ASCII Characters

Input
© 2026 — Café résumé
Output
&#xA9; 2026 &#x2014; Caf&#xE9; r&#xE9;sum&#xE9;

Decode HTML Entities

Input
&lt;p&gt;Tom &amp; Jerry &#x2014; &copy; 2026&lt;/p&gt;
Output
<p>Tom & Jerry — © 2026</p>

Frequently Asked Questions

What are HTML entities?
HTML entities are special sequences that represent characters which have a reserved meaning in HTML, such as <, >, &, and ". For example, &lt; represents the less-than sign (<). They prevent browsers from interpreting those characters as HTML markup.
What is the difference between named and numeric HTML entities?
Named entities use a human-readable name (e.g. &amp; for &, &lt; for <), while numeric entities use the character's Unicode code point in decimal (&#38;) or hexadecimal (&#x26;) form. Both are valid HTML and produce the same result in a browser.
When should I use HTML entity encoding?
You should encode text when inserting user-generated content into HTML to prevent XSS attacks and rendering issues. Any character that could be interpreted as HTML markup — particularly <, >, &, ", and ' — must be encoded to display correctly and safely.

Related Tools