Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »


4.2.5 • Public • Published

DiceBear Avatars

license npm

Avatars is an avatar placeholder library for designers and developers. You can choose between simple identicons and lovely designed characters. And best of all: We provide a simple and free HTTP API that you can use right away!



HTTP-API (recommended)

Our free HTTP-API is the easiest way to use Avatars. Just use the following URL as image source.


Replace :sprites with male, female, human, identicon, initials, bottts, avataaars, jdenticon, gridy or code. The value of :seed can be anything you like - but don't use any sensitive or personal data here!

The used sprite collection may offer additional options, which can be set using the GET parameter named options. For example, to create a happy male avatar with the seed john, the following URL can be used:



Choose NPM if you want to use a spriteCollection that is not available via the HTTP-API.

Install the Avatars package with the following command.

npm install --save @dicebear/avatars

You also need to add a sprite collection. In our example, we will use the male sprite collection.

npm install --save @dicebear/avatars-male-sprites

Now you are ready to create your first Avatar.

import Avatars from '@dicebear/avatars';
import sprites from '@dicebear/avatars-male-sprites';
let options = {};
let avatars = new Avatars(sprites, options);
let svg = avatars.create('custom-seed');

Available options

The following options are available for each sprite collection.

name alias type default description
radius r number 0 Avatar border radius
base64 bool false Return avatar as base64 data uri instead of XML
Not supported by the HTTP API
width w number null Fixed width
height h number null Fixed height
margin m number 0 Avatar margin in percent
HTTP-API limitation Max value 25
background b string null Any valid color identifier
HTTP-API limitation Only hex (3-digit, 6-digit and 8-digit) values are allowed. Use url encoded hash: %23.
userAgent string window.navigator.userAgent User-Agent for legacy browser fallback
Automatically detected by the HTTP API

More available options can be found in the README.md of each sprite collection.

Further information

You can find the complete documentation at avatars.dicebear.com


npm i @dicebear/avatars

DownloadsWeekly Downloads






Unpacked Size

385 kB

Total Files


Last publish


  • avatar