Encoders / Decoders

HTML Entity Encoder / Decoder

Convert <, >, &, " etc. to and from raw characters.

Input

Output

(output)

About this tool

Encode special HTML characters so they render as text instead of being interpreted as markup. Decode the other way to extract real text from HTML strings.

FAQs

Which characters get encoded?

&, <, >, ", ' at minimum. Some encoders also escape any non-ASCII character into &#NNN; numeric form.

Does this prevent XSS?

Encoding output before insertion is the standard XSS defense, yes - but only for the right context. Inside an attribute, inside JS, inside a URL each need different escaping.

What's the difference between &nbsp; and a regular space?

&nbsp; is a non-breaking space - browsers won't break a line at it, and consecutive ones aren't collapsed.

Other tools