The <alt> attribute has the fundamental purpose of briefly describing the image, so that if the image is not present for any reason, it can be replaced by the <alt> text (you may have now figured out that alt is an abbreviation for "alternate"). In most browsers however you can view both the image and the <alt> attribute simultaneously by having your mouse pointer over the image, in this scenario; the <alt> attribute serves as an assisting description. This tag is used by some search engines, while others do not use this tag unless the image is a link. Here is a code example of an image with both the <alt> attribute:
<img src="image.jpg" alt="Niagara Falls in summer">
Alt text can also assist your site in being more accessible to users with disabilities browsing with special speech or text-only browsers.
Alt text can be very important for search engine optimization if you use an image to display text on your website. Because the text displayed within the graphic is not recognized by a search engine's crawler, the information within it cannot be indexed, which is counter-productive to your site's ranking in that search engine's query results. Attributing alt text to that image allows the crawler to index the information and relate it to the image.