How to add favicon icon on HTML page

Various formats (such as .ico, .jpg, .png, .gif...) can be used as a favicon extension.
Although .ico has long been a standard extension, some browsers prefer .png icons.
The favicon icon code is always placed inside the <head> </head> tag section.

<link rel="icon" type="image/x-icon" href="favicon.ico"/>

There are also different sizes of favicon in pixels: 16x16, 32x32, 48x48, 64x64, 96x96...
Sizes of image favicons can be specified using the attribute sizes as in this example:

<link rel="icon" type="image/x-icon" sizes="16x16" href="favicon.ico-16x16"/>