Use the icon tool (there are many) to create 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 between <head></head>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
That's it. However, what Iico gives is a static icon file.
If you want to move, you have to do 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 to change the icon in your favorites, then add this sentence:
<link rel="Bookmark" href="favicon.ico" />
This icon can also be used in png format, which is now very popular.
Finally, I'll 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 the things you need, including the ICO file and source code.