Format:
188 input chars272 output chars25 entities found +84 size change
Input Text 188 chars
Encoded HTML

What is HTML Entity Encoder?

An HTML entity encoder and decoder is an essential developer utility for converting special characters into their safe HTML entity equivalents and back again. HTML entities prevent characters such as '<', '>', '&', and '"' from being interpreted as markup, which is critical for preventing cross-site scripting (XSS) vulnerabilities and ensuring text displays correctly across all browsers and character sets.

When you embed user-generated content, code snippets, or internationalized text into an HTML document, certain characters must be escaped. For example, displaying the literal string '<script>' on a page requires encoding the angle brackets as '&lt;' and '&gt;', otherwise the browser will interpret it as a real script tag. Similarly, the copyright symbol ©, non-breaking space, and hundreds of other special characters have named or numeric entity equivalents that guarantee consistent rendering regardless of the page encoding.

This tool supports both named entities (such as '&amp;', '&nbsp;', '&copy;') and numeric entities in decimal ('&#169;') and hexadecimal ('&#xa9;') formats. A built-in full reference table lets you browse all standard HTML entities with their character previews, so you can look up the exact entity name you need without leaving the page. Encode and decode in a single click with output ready to paste straight into your HTML.

How to Use HTML Entity Encoder

  1. Paste your text or HTML

    Enter raw text with special characters to encode, or paste HTML with entities to decode.

  2. Choose encode or decode

    Select "Encode" to convert special characters to HTML entities, or "Decode" to convert entities back to plain text.

  3. Review the output

    The converted result appears instantly. Review the side-by-side diff to confirm all entities are correctly transformed.

  4. Copy and use

    Click "Copy" to copy the encoded or decoded output to your clipboard and paste it into your project.

Key Benefits

Prevent XSS vulnerabilities

Encoding user input before inserting it into HTML prevents malicious script injection attacks.

Full entity reference table

Browse all standard named HTML entities with character previews — no need to memorise obscure codes.

Encode and decode

Convert in both directions: raw text to entities, or entities back to readable characters.

Instant processing

All encoding and decoding happens in real time in your browser with no server round-trip required.

Frequently Asked Questions

An HTML entity is a text string that begins with "&" and ends with ";" used to represent characters that have special meaning in HTML or cannot easily be typed, such as &amp; for & or &copy; for ©.

Always encode user-provided input before inserting it into HTML to prevent XSS attacks. Also encode characters like <, >, ", and & inside HTML attributes and text nodes.

Named entities use a readable name like &amp; or &copy;. Numeric entities use the character's Unicode code point in decimal (&#38;) or hexadecimal (&#x26;) form. Both are valid HTML.

Yes, any Unicode character can be represented as a numeric HTML entity. The encoder converts characters outside the basic ASCII range to their decimal or hex numeric entity equivalents.

Related Tools