HTML Encoder / Decoder

Encode and decode HTML entities online for free. Convert special characters into safe named, decimal, or hexadecimal entities to prevent XSS vulnerabilities and render markup safely.

HTML Encoder / Decoder

Convert special characters to HTML entities or decode entities back into plain text.

Presets:
Format:
Scope:
Plain / Raw Text Input:
Encoded HTML Entities Output:
Input: 95 charsOutput: 131 chars
Instant Client-Side Encoding & Decoding

How to use HTML Encoder / Decoder

  1. 1

    Choose your operation mode: "Encode HTML Entities" or "Decode HTML Entities".

  2. 2

    Select your entity format preference: Named entities (<), Decimal (<), or Hexadecimal (<).

  3. 3

    Type or paste your text or HTML snippet into the input box.

  4. 4

    View the converted text in real time with conversion statistics and click "Copy Result" or "Swap Directions".

Why use this tool?

Cross-Site Scripting (XSS) Prevention

Escape dangerous user-submitted markup (<, >, &, ", ') into safe entity representations before rendering in web views.

Named, Decimal & Hexadecimal Support

Choose between human-readable named entities (&amp;), universal numeric decimal entities (&#38;), or compact hex entities (&#x26;).

Two-Way Bi-directional Conversion

Seamlessly encode raw HTML markup or decode encoded API responses with a single click.

Full Unicode & Accent Handling

Encode non-ASCII currency signs, copyright markers, trademarks, and accented Latin characters accurately.

Frequently asked questions

Which characters are considered essential to escape in HTML?

The five critical characters that must always be escaped in HTML to prevent markup injection are: & (&amp;), < (&lt;), > (&gt;), " (&quot;), and ' (&#39; or &apos;).

What is the difference between named entities and numeric entities?

Named entities use memorable text aliases (e.g., &copy; for copyright or &nbsp; for non-breaking space). Numeric entities use Unicode codepoints in decimal (&#169;) or hexadecimal (&#xA9;), which are supported across older or non-standard HTML parsers.

Does this tool decode nested or multi-encoded HTML entities?

Yes! If text has been double-encoded (e.g., &amp;lt;), you can click decode once to resolve to &lt;, and a second time to resolve to <.

Related tools

Developer Tools