HTML Entity Encoder & Decoder

Convert special characters to entities and back — for safely showing code on a page.

Free
Every tool runs inside your browser; no data is ever sent to our servers.

About HTML Entity Encoder & Decoder

To display characters like less-than, greater-than or ampersand inside HTML you must write them as entities, otherwise the browser reads them as part of a tag. The same conversion, applied server-side, is the primary defence against script injection.

How to use HTML Entity Encoder & Decoder

  1. 1

    Enter your text or HTML snippet.

  2. 2

    Press encode to convert special characters into entities.

  3. 3

    Choose decode to turn entities back into plain characters.

  4. 4

    Drop the output into your template or document.

Frequently asked questions

Which characters must always be converted?

Ampersand, less-than, greater-than, and both quote types inside attribute values. Printing user input without this conversion leaves you open to XSS.

Does this replace server-side sanitisation?

No. This tool is for manual work and inspection. In a real application, encoding must happen at output time in the template layer — which Blade, for example, does by default.

Should non-Latin characters be encoded?

There is no need. With UTF-8 encoding they display directly, and converting them only inflates file size.