Gravatar stands for Globally Recognized Avatar. It is globally recognized because millions of people and websites use them. If you are a reader of blogs and add comments on the articles, chances are the blog or website might show an image which is loaded from the Gravatar. It’s simple and free, you can create your own gravatar from here.

In this post we are going to discuss about how to know if some user/email has no gravatar. If you are develoer and already using Gravatar in your website, you know how the Gravatar’s URL is generated. Below is the structure of Gravatar image URL-

http://www.gravatar.com/avatar/<md5 of the email>

Checking if the email has image uploaded on Gravatar

Now you know that to generate the Gravatar URL of any user, you will need to use md5 hash of their email address. That’s great but how to check if the email Gravatar has not been uploaded at all?

Simple, add a query parameter in the URL d=404 so the URL now becomes-

https://gravatar.com/avatar/63258e5d8246812736467d805c5433ae7d.jpg?d=404

Wasn’t that simple? :)