— HTML Entity Encoder/Decoder

Free HTML Entity Encoder/Decoder

Quick Tips

  • This tool runs entirely in your browser - your data stays private.
  • Press Ctrl+V (Cmd+V on Mac) to quickly paste text.
  • Use the Copy button to save your result to clipboard.
  • Bookmark this page for quick access!

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

Your Recent Tools

Examples

Input
<script>alert("XSS")</script>
Output
&lt;script&gt;alert(&quot;XSS&quot;)&lt;/script&gt;
Input
Price: $100 & tax
Output
Price: $100 &amp; tax
Input
&lt;div&gt;Hello&lt;/div&gt;
Output
<div>Hello</div>
Input
© 2024 Company™
Output
&copy; 2024 Company&trade;

Why Use This Tool?

What problems does this solve?

Special characters in HTML can break page layout or create security vulnerabilities. HTML entity encoding ensures characters display correctly and prevents malicious code injection through user input.

Common use cases:

  • Sanitizing user input before displaying on web pages
  • Showing code snippets with < and > characters
  • Including special symbols and typographic characters
  • Debugging rendering issues caused by unencoded characters
  • Preparing content for XML documents

Who benefits from this tool?

Web developers ensuring content displays correctly. Security professionals testing for XSS vulnerabilities. Content managers working with special characters. Anyone debugging HTML rendering issues.

Privacy first: All encoding and decoding happens locally in your browser. Your content never leaves your device.

Frequently Asked Questions

HTML entities prevent special characters from being interpreted as code. This is essential for security (preventing XSS attacks) and for displaying characters like < and & that would otherwise break your HTML.

Cross-Site Scripting (XSS) is an attack where malicious scripts are injected into web pages. By encoding < and > as &lt; and &gt;, injected script tags become harmless text instead of executable code.

Named entities like &amp;nbsp; are memorable but limited to predefined characters. Numeric entities like &amp;#160; can represent any Unicode character using its code point. Both produce the same result.

No, only encode characters that have special meaning in HTML: &, <, >, ", and optionally '. Over-encoding makes your HTML harder to read and is unnecessary for regular text.

&amp;nbsp; is a non-breaking space. Unlike regular spaces, browsers won't collapse multiple nbsp characters or break lines at nbsp positions. Use it to keep words together or add precise spacing.

Yes, most modern frameworks (React, Vue, Angular) automatically encode content inserted into templates. However, you must be careful with "dangerously set innerHTML" and similar features that bypass encoding.