JSONDev.in

HTML Encoder / Decoder

Encode and decode HTML entities online. Convert special characters like <, >, &, quotes to HTML entities and back. Free tool.

About this tool

Encode and decode HTML entities so special characters display safely in pages and don’t break markup. Useful for XSS-safe display of user text.

Example use case: Encode a code snippet containing <script> tags before pasting it into HTML content.

Input (Raw HTML)

Output (Encoded HTML)

Frequently Asked Questions

What is HTML encoding?▾
HTML encoding converts special characters into HTML entities so they display correctly in a browser without being interpreted as HTML markup. For example, < becomes &lt;, > becomes &gt;, and & becomes &amp;.
Why do I need to encode HTML?▾
HTML encoding is essential for security (preventing XSS attacks), displaying code snippets on web pages, and storing HTML content in databases. Without encoding, characters like < and > would break your HTML structure.
What characters need to be HTML encoded?▾
The five characters that must always be encoded are: & (&amp;), < (&lt;), > (&gt;), " (&quot;), and ' (&#39;). In certain contexts, additional characters like / and = should also be encoded.
What is the difference between HTML encoding and URL encoding?▾
HTML encoding converts characters to HTML entities (e.g. &amp;) for use inside HTML documents. URL encoding converts characters to percent-encoded sequences (e.g. %26) for use in URLs. They solve different problems and are not interchangeable.