A canonical tag or canonical code is a way of telling search engines that a specific URL represents the master copy of a page. Using the canonical tag prevents problems caused by identical or "duplicate" content appearing on multiple URLs.
Canonical tag is used to remove the issue of duplicate content...... Like opening the same website without www or with www....the google dont understand that it is same, it consider it different website.....to make google understand the site is same we use canonical tag
The canonical tag is an important tag used in SEO optimization to avoid possible content duplication between two pages published with content similarity. If the same content portion is published with more than 1 URL it may cause content duplication. To avoid the problems of content duplication canonical tags are used.
The rel=canonical element, often called the “canonical link”, is an HTML element that helps webmasters prevent duplicate content issues. It does this by specifying the “canonical URL”.