Free & Private Online Browser Utility

HTML Entity Encoder & Decoder

Encode special characters into safe HTML entities and decode character references back to plain text directly in your browser. Convert dangerous symbols (&, <, >, ", ') into named entities (&amp;, &lt;, &gt;) or numeric decimal (&#60;) and hexadecimal (&#x3C;) equivalents to prevent cross-site scripting (XSS) and broken markup. All string transformations execute locally in browser memory without sending text over the network.

How to use

  1. Step 1: Paste Source Text

    Enter or paste HTML code snippets, user input strings, or formatted text into the editor.

  2. Step 2: Select Encoding Format

    Choose Named Entities (&amp;), Decimal Numeric (&#38;), or Hexadecimal (&#x26;).

  3. Step 3: Copy Sanitized Result

    Click Copy to grab the encoded markup ready to embed safely in HTML source files.

Options explained

Named Entity Conversion

Translates standard ASCII and Latin-1 symbols into readable named references (&copy;, &quot;).

When to use: Use when writing human-readable HTML documentation and code examples.

Numeric Hex / Decimal Mode

Encodes characters using Unicode code points (&#xNN; or &#NN;).

When to use: Use for XML compatibility where named HTML entities are not natively recognized.

Bidirectional Decoder

Decodes encoded entity strings back into natural unescaped human-readable characters.

When to use: Use when cleaning scraped web data or inspecting encoded URL query parameters.

Worked example

Input: String: '<script>alert("XSS")</script>'

Output: Encoded: '&lt;script&gt;alert(&quot;XSS&quot;)&lt;/script&gt;'

Processed via DOM element attribute escaping and Unicode code point mapping.

Tips & limits

  • The 5 primary XML/HTML entities requiring escaping are: & (&amp;), < (&lt;), > (&gt;), " (&quot;), and ' (&#39;).
  • Always encode user-supplied text before rendering it inside HTML tags to prevent cross-site scripting attacks.
  • Numeric entities (&#x3C;) work in strict XML and SVG contexts where HTML entity names like &nbsp; may fail.

Common problems

Double-encoding turns &lt; into &amp;lt;

Avoid running entity encoding on already-encoded text; decode first if working with mixed data sources.

Non-breaking spaces appear as weird characters

&nbsp; translates to Unicode non-breaking space (U+00A0); use standard decode mode to restore standard spaces.

Frequently Asked Questions (FAQ)

Why is HTML entity encoding critical for web security?

Encoding characters like < and > helps browsers treat user input strictly as text rather than executable markup, neutralizing cross-site scripting (XSS) vectors.

What is the difference between named and numeric entities?

Named entities use mnemonic words (&copy; for ©) defined in HTML specifications; numeric entities use exact Unicode code points (&#169; or &#xA9;) recognized across all XML parsers.

Is my text data stored or shared?

No. All entity mapping and regex replacements run in local browser memory with zero network requests.

Files never leave your device; calculations and transformations happen locally.

Last reviewed: 2026-10-19 · Build: deb3bc0