ESC

Input Text

Named entities: Uses &, <, >, " format.

Result

All processing happens in your browser. No data is sent to any server.

Usage Examples

XSS Prevention

Encode HTML tags and special characters to prevent Cross-Site Scripting (XSS) attacks when displaying user input.

HTML Source Display

Encode HTML code so it can be safely displayed as text within web pages without being rendered.

Special Characters

Decode HTML entities like &, <, > back to their original characters for text processing.

Features

XSS Protection

Encode user input to prevent cross-site scripting attacks in web applications

Two-Way Conversion

Encode characters to entities and decode entities back to characters seamlessly

Named & Numeric Modes

Choose between human-readable named entities or universal numeric entities

Privacy First

All processing runs locally in your browser, no data sent to servers

How to Use

1

Choose Entity Mode

Select Named mode for readable entities like &amp; or Numeric mode for &#38; format.

2

Enter Text

Type or paste the HTML code or text you want to encode, or paste encoded entities to decode.

3

Encode or Decode

Click Encode to convert to entities, or Decode to convert entities back to characters. Copy the result.

Frequently Asked Questions

HTML entities are special codes that represent characters which would otherwise be interpreted as HTML markup. The most important ones: &lt; (less-than, <), &gt; (greater-than, >), &amp; (ampersand, &), &quot; (double quote, "), &apos; (apostrophe, '). You need them whenever you display user-provided text in HTML, show code examples, or prevent cross-site scripting (XSS) attacks.

Named entities use descriptive names: &amp;amp; for &, &amp;lt; for <, &amp;copy; for ©. They are easier to read and remember. Numeric entities use the Unicode code point: &amp;#38; for &, &amp;#60; for <, &amp;#169; for ©. Numeric entities work for any Unicode character, including those without a named equivalent. Both are equally valid in HTML.

Cross-site scripting (XSS) occurs when user input containing HTML tags or JavaScript is rendered as code instead of text. Encoding converts < to &amp;lt; and > to &amp;gt;, so the browser displays them as characters rather than interpreting them as tags. Always encode untrusted content before inserting it into HTML. Note: encoding alone is not sufficient if you are inserting content into JavaScript contexts, CSS, or URL attributes — those require different escaping rules.

Five characters must be encoded in HTML content: & (ampersand) → &amp;amp;, < (less-than) → &amp;lt;, > (greater-than) → &amp;gt;, " (double quote, inside attribute values) → &amp;quot;, ' (apostrophe, inside single-quoted attributes) → &amp;apos;. Other characters like accented letters (é, ü, ñ) and symbols (©, ®, ™) can be encoded for compatibility but are safe in modern UTF-8 HTML without encoding.

Paste the encoded HTML (with &amp;amp;, &amp;lt;, etc.) into the input field and click Decode. The tool converts all named and numeric entities back to their original characters. Useful when reading database content, API responses, or legacy data that was over-encoded.

&amp;nbsp; (non-breaking space, U+00A0) is a space that prevents line breaks between words and prevents consecutive spaces from collapsing to one. Use it sparingly: for keeping measurements together (10&amp;nbsp;km), preventing word wrapping in UI labels, or creating intentional spacing in formatted content. Do not use it as a layout tool — use CSS padding/margin instead.

Yes. Paste your entire document and click Encode or Decode. The tool processes the full text including any HTML tags. Note that if you encode a complete HTML document, the output will have all angle brackets encoded — tags like &lt;div&gt; become &amp;lt;div&amp;gt;. This is useful for displaying source code in tutorials, not for processing documents you want to keep functional.

No. All encoding and decoding runs locally in your browser using JavaScript. Your text is never transmitted to any server or stored anywhere.

What Is an HTML Entity Encoder?

If you have ever pasted user input into a web page and watched the layout break, you already know why HTML entities matter. Characters like <, >, &, and " have special meaning in HTML, so they need to be escaped before they hit the DOM. This tool handles that conversion instantly -- paste your text, pick named or numeric mode, and grab the result.

Encoding vs. Decoding

Encoding turns raw characters into safe entity references (&lt;, &amp;, etc.) so browsers render them as text instead of markup. Decoding does the reverse -- handy when you pull entity-encoded strings from a database or API and need the original characters back.

Common Use Cases

The biggest one is XSS prevention: encoding user input before rendering it closes a major attack vector. Developers also use it to display code examples inside blog posts or documentation without the browser trying to execute the markup.

Quick Tips

Use named entities for the five most common characters (&, <, >, ", ') since they are easy to spot in code reviews. Switch to numeric mode when you are dealing with extended Unicode characters that do not have named equivalents.

Privacy Note

All encoding and decoding happens right in your browser. Nothing is uploaded, nothing is logged. Close the tab and it is gone.

Security and Privacy

Your data security is our priority

Local Processing

All processing happens in your browser

No Data Transfer

Your data is not sent to our servers

No Data Storage

No data is stored or shared

SSL Encryption

SSL encryption for secure connection

Also on MoreOnlineTools