0 characters
0 characters

How to Use

1
Paste your text. Type or paste any text or HTML containing special characters into the input box.
2
Choose Encode or Decode. Click Encode to convert characters like < > & " to HTML entities. Click Decode to convert HTML entities back to their original characters.
3
Copy the result. Click Copy Output to copy the result to your clipboard. Use Swap to send the output back to the input for chained operations.

Common HTML Entities Reference

Character Entity Description & &amp; Ampersand < &lt; Less-than sign > &gt; Greater-than sign " &quot; Double quotation mark ' &#39; Single quotation mark (apostrophe)   &nbsp; Non-breaking space © &copy; Copyright symbol ® &reg; Registered trademark ™ &trade; Trademark symbol

HTML encoding is essential for web security. When displaying user-supplied content in a page, encoding prevents browsers from interpreting the content as HTML markup. An unencoded string like <script>alert('xss')</script> entered by a user and displayed without encoding would execute as JavaScript. After encoding it becomes the harmless text &lt;script&gt;alert('xss')&lt;/script&gt;. This is the primary defence against cross-site scripting (XSS) attacks.

Frequently Asked Questions

What are HTML entities?

HTML entities are special codes that represent characters with special meaning in HTML, such as < (less-than), > (greater-than), and & (ampersand). Writing these as entities tells the browser to display them as text rather than interpret them as HTML markup.

When should I encode HTML?

Always encode HTML when displaying user-supplied content in a web page. This prevents cross-site scripting (XSS) attacks where malicious users inject script tags or HTML into your page via form inputs or URL parameters. Most server-side frameworks do this automatically, but manual encoding is important when you are building raw HTML strings.

What characters are encoded?

The five critical characters are: & (becomes &amp;), < (becomes &lt;), > (becomes &gt;), double quote (becomes &quot;), and single quote (becomes &#39;). These are the characters that can break HTML structure or enable injection attacks.

What is the difference between HTML encoding and URL encoding?

HTML encoding converts characters to HTML entity codes for safe use inside HTML content. URL encoding (percent-encoding) converts characters to %XX format for safe use in URL paths and query strings. They are different systems for different contexts. Use this tool for HTML and use the URL Encoder for URL components.

Is my data sent to a server?

No. All encoding and decoding runs in your browser using JavaScript. No text is ever uploaded, stored, or sent to any server.

Get fresh reads straight to your inbox

Get notified when we publish new articles. Unsubscribe anytime.