HTML Entities Encoder / Decoder Encode and decode a piece of text to its HTML equivalent

Input enter the text to encode/decode
Enter the text to encode or decode or decode.
Output encoded/decoded text
Input some data to be encoded or decoded.

Description

The HTML character encoder converts all applicable characters to their corresponding HTML entities. Certain characters have special significance in HTML and should be converted to their correct HTML entities to preserve their meanings.
For example, it is not possible to use the < character as it is used in the HTML syntax to create and close tags. It must be converted to its corresponding &lt; HTML entity to be displayed in the content of an HTML page. HTML entity names are case sensitive.

Reserved entities, symbols and characters in HTML

This table shows a list of reserved HTML entities with their associated character and description.

Character Entity name Description
" &quot; quotation mark
' &apos; apostrophe 
& &amp; ampersand
< &lt; less-than
> &gt; greater-than
  &nbsp; non-breaking space
¡ &iexcl; inverted exclamation mark
¢ &cent; cent
£ &pound; pound
¤ &curren; currency
¥ &yen; yen
¦ &brvbar; broken vertical bar
§ &sect; section
¨ &uml; spacing diaeresis
© &copy; copyright
ª &ordf; feminine ordinal indicator
« &laquo; angle quotation mark (left)
¬ &not; negation
­ &shy; soft hyphen
® &reg; registered trademark
¯ &macr; spacing macron
° &deg; degree
± &plusmn; plus-or-minus 
² &sup2; superscript 2
³ &sup3; superscript 3
´ &acute; spacing acute
µ &micro; micro
&para; paragraph
· &middot; middle dot
¸ &cedil; spacing cedilla
¹ &sup1; superscript 1
º &ordm; masculine ordinal indicator
» &raquo; angle quotation mark (right)
¼ &frac14; fraction 1/4
½ &frac12; fraction 1/2
¾ &frac34; fraction 3/4
¿ &iquest; inverted question mark
× &times; multiplication
÷ &divide; division
À &Agrave; capital a, grave accent
Á &Aacute; capital a, acute accent
 &Acirc; capital a, circumflex accent
à &Atilde; capital a, tilde
Ä &Auml; capital a, umlaut mark
Å &Aring; capital a, ring
Æ &AElig; capital ae
Ç &Ccedil; capital c, cedilla
È &Egrave; capital e, grave accent
É &Eacute; capital e, acute accent
Ê &Ecirc; capital e, circumflex accent
Ë &Euml; capital e, umlaut mark
Ì &Igrave; capital i, grave accent
Í &Iacute; capital i, acute accent
Î &Icirc; capital i, circumflex accent
Ï &Iuml; capital i, umlaut mark
Ð &ETH; capital eth, Icelandic
Ñ &Ntilde; capital n, tilde
Ò &Ograve; capital o, grave accent
Ó &Oacute; capital o, acute accent
Ô &Ocirc; capital o, circumflex accent
Õ &Otilde; capital o, tilde
Ö &Ouml; capital o, umlaut mark
Ø &Oslash; capital o, slash
Ù &Ugrave; capital u, grave accent
Ú &Uacute; capital u, acute accent
Û &Ucirc; capital u, circumflex accent
Ü &Uuml; capital u, umlaut mark
Ý &Yacute; capital y, acute accent
Þ &THORN; capital THORN, Icelandic
ß &szlig; small sharp s, German
à &agrave; small a, grave accent
á &aacute; small a, acute accent
â &acirc; small a, circumflex accent
ã &atilde; small a, tilde
ä &auml; small a, umlaut mark
å &aring; small a, ring
æ &aelig; small ae
ç &ccedil; small c, cedilla
è &egrave; small e, grave accent
é &eacute; small e, acute accent
ê &ecirc; small e, circumflex accent
ë &euml; small e, umlaut mark
ì &igrave; small i, grave accent
í &iacute; small i, acute accent
î &icirc; small i, circumflex accent
ï &iuml; small i, umlaut mark
ð &eth; small eth, Icelandic
ñ &ntilde; small n, tilde
ò &ograve; small o, grave accent
ó &oacute; small o, acute accent
ô &ocirc; small o, circumflex accent
õ &otilde; small o, tilde
ö &ouml; small o, umlaut mark
ø &oslash; small o, slash
ù &ugrave; small u, grave accent
ú &uacute; small u, acute accent
û &ucirc; small u, circumflex accent
ü &uuml; small u, umlaut mark
ý &yacute; small y, acute accent
þ &thorn; small thorn, Icelandic
ÿ &yuml; small y, umlaut mark

Code samples

Most programming languages provide a way to convert HTML entities to their associated character and vice-versa.

htmlentities (PHP 4, PHP 5)

Convert all applicable characters to HTML entities.

string htmlentities ( string $string [, int $flags = ENT_COMPAT | ENT_HTML401 [, string $encoding = ini_get("default_charset") [, bool $double_encode = true ]]] )

This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.
If you're wanting to decode instead (the reverse) you can use html_entity_decode().

HttpUtility.HtmlEncode Method (String) .NET Framework 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

Converts a string to an HTML-encoded string.

public static string HtmlEncode( string s )

HTML encoding converts characters that are not allowed in HTML into character-entity equivalents; HTML decoding reverses the encoding. For example, when embedded in a block of text, the characters < and > are encoded as &lt; and &gt; for HTTP transmission.

References and links of interest

Wikipedia: Character entity reference

Wikipedia: Character entity reference

In the markup languages SGML, HTML, XHTML and XML, a character entity reference is a reference to a particular kind of named entity that has been predefined or explicitly declared in a Document Type Definition (DTD). The "replacement text" of the entity consists of a single character from the Universal Character Set/Unicode. The purpose of a character entity reference is to provide a way to refer to a character that is not universally encodable.

Opinionated Geek HTML Encoder

OpinionatedGeek HTML Encoder

Type or paste in the text you want to HTML encode, then press the "Encode" button, or read a brief explanation of the process of HTML encoding.