Use an icon tool (there are many) to make an icon file (favicon.ico) and upload it to the root directory of the server where the website is located. This file must be an icon file of 16*16 size. Of course, you can also add it between <head></head>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
That's it. However, ico gives a static icon file.
If you want it to move, you have to make a gif animation. The gif animation is also 16*16 and is transmitted to the server. Add: between <head></head>:
<link rel="icon" href="animated_favicon.gif" type="image/gif" >
That's it.
If you want the icon in your favorites to also change, then add this sentence:
<link rel="Bookmark" href="favicon.ico" />
This icon can also be used in png format, which is very popular now.
Finally, give a URL to make these things online:
http://www.html-kit.com/favicon/
Follow the prompts step by step, and finally you can download what you need, including ico files and source code.