What is Canonical tag?
A canonical tag is an HTML hint (rel="canonical") that names the URL you want engines to treat as the primary version of a page.
Duplicate URLs happen through parameters, trailing slashes, http and https, print views, and tag pages. The canonical is how you point them at one indexable address so signals are not split and the wrong variant is not the one that ranks.
It is a hint, not a command. Engines can ignore it if the pages are not actually the same or if the rest of the signals contradict it. Use one canonical per page, make it absolute, and make it match the URL you link to internally.