How DiceBear Generates the Same Avatar from a Seed

Updated

DiceBear turns any string you choose — a username, email address, or user ID — into an avatar, and it produces the exact same image every time that string is used. The mechanism is called a seed: instead of storing an image file, you store the string, and DiceBear deterministically derives the avatar from it. This works across the HTTP API, the JavaScript, PHP, Python, Rust, Go, Dart, and C# libraries, and the CLI, so the same seed yields the same avatar on any platform.

What a seed actually is

A seed is just an input string. DiceBear's own framing is "Pick a seed. Get an avatar," and its documentation states the rule directly: "Same Seed, Same Avatar. Every Time." You can use anything stable and unique per user:

  • a username or handle
  • an email address
  • a database ID or UUID
  • any other string you can reproduce later

The seed does not need to be secret or formatted in a special way. What matters is that you can supply the same string again when you need the same avatar.

Why the same seed always produces the same avatar

DiceBear is a deterministic generator, not a random one. When you request an avatar, the seed is used to drive the style's choices — which combination of features, colors, and shapes gets drawn — so the output is a pure function of the inputs (seed plus style plus any options). There is no hidden random state that changes between calls.

This is why DiceBear describes its output as deterministic SVG profile pictures. The practical consequence: you never have to store or upload an avatar image. Store the seed, regenerate the avatar on demand, and it will match what you showed before.

The inputs that determine the result

The seed is the main input, but it is not the only one. To get an identical avatar, keep all of these the same:

Input Why it matters
Seed string The core value the avatar is derived from
Style Each of the 61 styles draws differently; lorelei and adventurer will not match
Style version / API version The example uses 10.x; a different major version can change output
Other options Any additional parameters you set (for example size or background) affect the rendered result

Change the seed and you get a different avatar. Change the style and you get a different avatar for the same seed. Keep everything constant and the result is stable.

How to generate one, by interface

The same seed works everywhere. Using Felix as the seed and the lorelei style:

HTTP API

https://api.dicebear.com/10.x/lorelei/svg?seed=Felix

JavaScript

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

const style = new Style(definition);
const avatar = new Avatar(style, { seed: 'Felix' });

Python

from importlib.resources import files
from dicebear import Avatar, Style

style = Style.from_json(
    files("dicebear_styles").joinpath("lorelei.json").read_text("utf-8")
)
avatar = Avatar(style, { "seed": "Felix" })

Rust

use dicebear_core::{Avatar, Style};
use serde_json::json;

let style = Style::from_str(dicebear_styles::LORELEI)?;
let avatar = Avatar::new(&style, json!({ "seed": "Felix" }))?;

Go

import (
    dicebear "github.com/dicebear/dicebear-go/v10"
    "github.com/dicebear/styles/v10"
)

style, _ := dicebear.NewStyle([]byte(styles.Lorelei))
avatar, _ := dicebear.NewAvatar(style, map[string]any{
    "seed": "Felix",
})

Dart

import 'package:dicebear_core/dicebear_core.dart';
import 'package:dicebear_styles/lorelei.dart';

final style = Style.parse(lorelei);
final avatar = Avatar(style, { 'seed': 'Felix' });

C#

using System.Text.Json.Nodes;
using DiceBear;

var style = Style.Parse(Styles.Lorelei);
var avatar = new Avatar(style, new JsonObject {
    ["seed"] = "Felix",
});

CLI

npx dicebear lorelei --seed 'Felix'

Each of these takes the seed Felix, applies the lorelei style, and returns the same avatar. The Playground is the quickest way to confirm the behavior before wiring it into code.

Cross-platform consistency in practice

Because the seed fully determines the output, you can generate an avatar on the server, in a mobile app, or in a build script and get matching results — as long as the style and version line up. This is what makes seeds useful for user profiles: you can render a default avatar before a user uploads a photo, then keep the seed as a fallback, and it will always look the same.

Two practical notes:

  • Pick a stable seed. If you use an email address, changing the email changes the avatar. A user ID is usually the most stable choice.
  • Pin your version. The API path includes a version (10.x in the example). Upgrading a major version can alter how a style renders, so treat the version as part of the identity if visual consistency over time matters.

Where the styles come from

DiceBear ships 61 avatar styles, ranging from hand-drawn characters to abstract patterns, pixel art, and detailed illustrations. Some are contributed by independent artists and some are designed by the project. For example, the lorelei style is a remix of artwork by Lisa Wischofsky, licensed under CC0 1.0. Because each style has its own drawing logic, the same seed produces a different-looking avatar per style — but a consistent one within any single style.

Common points of confusion

  • "The avatar changed and I didn't change the seed." Check the style, the version, and any other options first; those are the usual causes.
  • "Can I get a random avatar?" The point of a seed is reproducibility. If you want variety, vary the seed (for example, append a counter), not the generator.
  • "Do I need to store the image?" No. Store the seed and regenerate. DiceBear is described as privacy-focused and self-hostable, so you can also run it yourself if you prefer not to call the hosted API.