HTML Entity Encoder / Decoder

Encode or decode HTML entities to display special characters safely.

I want to:

Frequently asked questions

When should I encode HTML entities?

Whenever a character would otherwise be read as markup, angle brackets and ampersands in particular, or when you need a symbol your editor cannot type directly.

Does it handle both named and numeric entities?

Yes. Named forms and numeric forms are both recognized when decoding.

What is the difference between < and <?

They are the same character written two ways. The named form is easier to read in source; the numeric form works even where the name is not recognized.

Do I still need entities if my page is UTF-8?

For accented letters and symbols, usually not. For the characters that mean something in HTML, yes. An unescaped angle bracket or ampersand can break the markup or open a hole an attacker can put script through.

Should I encode quotes inside an attribute?

Yes. A double quote inside a double-quoted attribute ends the attribute early and breaks the tag, so encode it as ".

Why did my   turn into a space that behaves oddly?

A non-breaking space looks exactly like an ordinary space but stops the line wrapping at that point. Decoding turns the entity into that invisible character; the Invisible Character Remover takes them back out.