Florian Körner 8bc58b2d96 v10.6.1
2026-08-18 23:25:14 +02:00
2024-06-30 12:33:59 +02:00
2026-08-18 23:25:14 +02:00
2026-08-18 23:25:14 +02:00
2024-06-13 22:24:00 +02:00
2026-08-18 23:25:14 +02:00
2026-08-18 23:25:14 +02:00
2026-08-01 14:32:39 +02:00

DiceBear Avatar Library

A grid of DiceBear avatars in twenty-four different styles

npm stars license

DiceBear is an open source avatar library. It turns any seed string (a username or an email address, for example) into an SVG avatar in one of 55 styles, from hand-drawn characters to abstract patterns. The same seed always produces the same avatar, so you store a string instead of an image and never ask users to upload a profile picture.

Avatars are customizable through style options: colors, backgrounds, rotation, individual features like hair or glasses.

Playground | Documentation | Editor

One library, six languages

DiceBear 10 ships as native libraries for JavaScript, PHP, Python, Rust, Go, and Dart. Every port passes a shared test suite that requires byte-identical SVG output to the JavaScript reference. Generate an avatar in the browser, regenerate it later in a Go or PHP backend, and you get the same bytes.

Language Package Install
JavaScript / TypeScript @dicebear/core npm install @dicebear/core
PHP dicebear/core composer require dicebear/core
Python dicebear-core pip install dicebear-core
Rust dicebear-core cargo add dicebear-core
Go dicebear-go go get github.com/dicebear/dicebear-go/v10
Dart dicebear_core dart pub add dicebear_core

In JavaScript it looks like this; the documentation has the equivalent for each language:

import { Avatar } from '@dicebear/core';
import definition from '@dicebear/styles/lorelei.json' with { type: 'json' };

const avatar = new Avatar(definition, {
  seed: 'John Doe',
  size: 128,
});

avatar.toString(); // SVG string
avatar.toDataUri(); // data:image/svg+xml;charset=utf-8,...

The 55 avatar styles are plain JSON definitions from the dicebear/styles repository, available as a package for each language. You can also create your own style, with Figma or from scratch.

Without writing code

  • The HTTP API returns avatars from a plain URL, free and without an account: https://api.dicebear.com/10.x/lorelei/svg?seed=Felix. For full control and privacy you can host it yourself with a single Docker container.
  • The CLI generates avatar files in bulk: npx dicebear lorelei --count 10.
  • The editor lets you assemble a single avatar by hand and export it.

This repository

This monorepo contains the six core libraries, the CLI, the SVG-to-raster converter, the documentation site (dicebear.com), and the editor. Related projects live in their own repositories:

Contributions are welcome; CONTRIBUTING.md explains the setup and where each kind of change belongs.

License

The code is MIT licensed, including commercial use. The avatar styles are the work of their respective creators and carry their own licenses; the license overview lists them all, and many only ask for attribution.

Star this repository

If DiceBear saved you some work, a star makes the project easier to find for the next person looking for an avatar library. The support page lists the other ways to help.

Sponsors

Advertisement: Many thanks to our sponsors who provide us with free or discounted products.

bunny.net
S
Description
面向设计师和开发者的头像库|GitHub 镜像 9.4k · 🍴 403
https://github.com/dicebear/dicebear Readme MIT 31 MiB
Languages
Vue 26.1%
TypeScript 22.1%
Dart 11.3%
PHP 10.3%
Python 9.1%
Other 21.1%