If a library or plugin is not availble for your language or application, your best option at the moment is to use our simple API. Don't worry though, it's really not that much work!


Chris Forbes is maintaining the C# bindings.

using libravatarsharp;
var uri = AvatarUri.FromEmail( "" );

(!) The library does not support federation.

Common Lisp

There is a library supporting both Gravatar, Libravatar and Unicornify.


The Libravatar library is maintained by fr33domlover and is available on hackage.

import Network.Libravatar
myUrl = avatarUrl (Right "") True Nothing (Just 100)


Alessandro Leite has created a library in Java.

(!) The library does not support federation.


A tiny Nim library. Federation is not supported by design as DNS discovery is left to the user.

(!) The library does not support federation.


There is a Libravatar node.js module that can be used in the following way:

var libravatar = require('libravatar');
libravatar.url(email='', openid=null, { size: 96, default: 'mm' }, https=false,
  function (error, avatar_url) {
    console.log('<img src="' + avatar_url + '">');

You can also use the ember-cli module.


The Libravatar::URL module is part of the Gravatar::URL package (libgravatar-url-perl in Debian and Ubuntu) since version 1.03.

use Libravatar::URL;
my $avatar_url = libravatar_url(email => '');
print '<img src="' . $avatar_url . '">';

As of version 1.04, you can also use OpenID URLs instead of email addresses:

my $avatar_url = libravatar_url(openid => '');


Melissa Draper maintains the Services_Libravatar PEAR package. Here's an example of how it works:

require_once 'Services/Libravatar.php';
$libravatar = new Services_Libravatar();
$avatar_url = $libravatar->getUrl('');
print '<img src="' . htmlspecialchars($avatar_url) . '" alt="avatar"/>';

or like this for OpenID-based avatars served over HTTPS:

$avatar_url = $libravatar->getUrl('', array('https' => true));


The pyLibravatar module can be used like this:

from libravatar import libravatar_url
avatar_url = libravatar_url(email = '')
print '<img src="' + avatar_url + '">'


The source code for Rawatar can be found on


There is a Ruby library for Libravatar named Vishnu, published as the Ruby gem vishnu. Example usage of Vishnu:

require 'vishnu'  '').url   # get avatar for email '').url   # get avatar for OpenID URL

Previously, Kang-min Liu created a Ruby library named Libravatar, published as the Ruby gem libravatar. As of 2020 the library appears to be unmaintained – it has some ignored issues and pull requests that were created four years ago.

require 'libravatar'
avatar_url = => '')
# or avatar_url = => '')
print '<img src="', avatar_url, '">'


Gravatarhash is a pure shell utility supporting Libravatar and Gravatar.


Julien Fastré has a created a Libravatar bundle for the PHP framework Symfony.


The txLibravatar module can be used like this:

from txlibravatar import libravatar_url
d = libravatar_url(email = '')
d.addCallback(lambda x: print '<img src="' + x + '">')


The go-libravatar module can be used like this:

import ""
avt := libravatar.New()
avatar_url := avt.FromEmail("")

or, with global context

avatar_url := libravatar.FromEmail("")


There aren't many plugins available at the moment, but please suggest the ones you'd like to have.


Writing a library in your language of choice is not very hard but here are a few guidelines to help you produce a library that will be as complete as possible:

  • Read the API documentation carefully.
  • Make sure you normalize emails and OpenID URLs according to the rules.
  • Email hashes should default to MD5 (for the Gravatar redirection to work) while SHA256 is the only hash allowed for OpenID hashes.
  • The base URL should be looked up in DNS to ensure that federation is possible.
  • SRV weight and priority handling is tricky. Have a look at srv_hostname() to see how it's done in the CPAN module.

If you have any questions or run into any problems, come talk to us. Moreover if you are interested in writing a plugin for your favourite framework/CMS or a library for your favourite language get in touch too, we would be more than happy to link to them from this page!