which runs as code). Always HTML-encode user input before inserting it into HTML. Modern frameworks like React do this automatically when you use JSX expressions."}},{"@type":"Question","name":"What is the difference between HTML encoding and URL encoding?","acceptedAnswer":{"@type":"Answer","text":"HTML encoding converts characters to &name; or &#num; entities safe for HTML context. URL encoding (percent encoding) converts characters to %XX hex values safe for URLs. They serve different contexts: HTML encoding for content inside HTML documents, URL encoding for parameters inside URLs. Never swap them — using URL encoding in HTML or vice versa will produce incorrect output."}},{"@type":"Question","name":"Does React/Vue automatically escape HTML?","acceptedAnswer":{"@type":"Answer","text":"Yes. React, Vue, and Angular automatically HTML-encode text when you use template expressions ({} in JSX, {{}} in Vue/Angular). This is the main XSS prevention mechanism in modern frameworks. You must opt in to raw HTML rendering (dangerouslySetInnerHTML in React, v-html in Vue, [innerHTML] in Angular) — and only do so with sanitized content."}},{"@type":"Question","name":"What is   and when should I use it?","acceptedAnswer":{"@type":"Answer","text":"  is a non-breaking space — a space character that prevents line breaks at that position. It's used to keep words together (10 km, John Smith), add visual padding in HTML (instead of multiple spaces, which collapse to one), or prevent empty table cells from collapsing. In modern CSS, use white-space: nowrap or margin/padding instead of   for layout."}},{"@type":"Question","name":"What are numeric HTML entities and when do I use them?","acceptedAnswer":{"@type":"Answer","text":"Numeric entities reference a character by its Unicode code point: A = A (decimal), A = A (hex). They work for any Unicode character, including those without named entities. Useful for: characters that don't have named entities, ensuring specific characters render across all browsers, and embedding characters that might be misinterpreted in source files."}}]}]}

Free · Instant · Client-Side Only

HTML Entity Encoder / Decoder

Escape HTML special characters to entities or decode entities back to plain text. Essential for safe HTML output and preventing XSS.

Common Entities

HTML / Text to Encode

Frequently Asked Questions

What are HTML entities?

HTML entities are special codes representing characters that have meaning in HTML markup. For example, < starts a tag, so to display a literal < you write &lt;. The five essential entities: &amp; (&), &lt; (<), &gt; (>), &quot; ("), &#39; ('). Named entities also exist for symbols: &copy; (©), &trade; (™), &nbsp; (non-breaking space).

Why do I need to encode HTML entities?

Encoding prevents two problems: broken HTML (unescaped < can be misread as a tag, breaking your layout) and XSS (Cross-Site Scripting) attacks — where attackers inject <script>alert(1)</script> which runs as code. Always HTML-encode user input before inserting it into HTML. Modern frameworks like React do this automatically for JSX expressions.

What is the difference between HTML encoding and URL encoding?

HTML encoding converts special characters to &name; or &#num; entities safe for HTML content. URL encoding converts characters to %XX hex values safe for URLs. They serve different contexts: HTML encoding for content inside HTML documents, URL encoding for query parameters in URLs. Never swap them.

Does React/Vue automatically escape HTML?

Yes. React, Vue, and Angular automatically HTML-encode text in template expressions ({} in JSX, {{}} in Vue). This is the main XSS prevention mechanism. You must explicitly opt in to raw HTML (dangerouslySetInnerHTML in React, v-html in Vue) — only do so with properly sanitized, trusted content.

What is &nbsp; and when should I use it?

&nbsp; is a non-breaking space that prevents line breaks at that position. It keeps words together (10&nbsp;km), prevents empty cells from collapsing in tables, and adds visible spacing in HTML (multiple normal spaces collapse to one). In modern development, prefer CSS white-space: nowrap or margin/padding for layout instead of &nbsp;.

What are numeric HTML entities and when do I use them?

Numeric entities reference a character by its Unicode code point: &#65; = A (decimal), &#x41; = A (hex). They work for any Unicode character, including those without named entities. Useful for characters that might be misinterpreted in source files, unusual symbols, and ensuring cross-browser compatibility.

How It Compares

FeatureAnvya AIhtmlentities.comBrowser console
Encode + Decode in one placePartialPartial
Quick character reference panel
Swap output to input
Change count shown
No ads
Works offlinePartial
Free forever