Skip to content
View as Markdown

How avatars are made ​

Every DiceBear avatar is an SVG composed at request time.

Nothing is drawn pixel by pixel: an avatar style is a JSON definition that describes components such as hair, eyes, or mouth, each with a set of variants and colors. The renderer picks one variant per component, applies the colors, and assembles the parts into a single SVG. That's cheap enough to do on every request, and the result scales to any size without losing sharpness.

The seed makes it deterministic ​

The picks are random, but seeded. Your seed is hashed with FNV-1a and the hash initializes a Mulberry32PRNG. Every decision the renderer makes, which hair, which eyes, which color, draws from this generator. Because everything derives from the seed, the same seed walks through the exact same decisions and produces the exact same avatar, today and in ten years.

One consequence worth knowing: the PRNG is notcryptographically secure, and it doesn't try to be. Use seeds to get stable avatars, not to derive anything secret.

The same in every language ​

All DiceBear libraries implement this pipeline with byte-identical output, and the HTTP API renders with the JavaScript library, so it draws the same avatars. The style definitions are plain JSON that every implementation consumes as-is, and the PRNG behaves the same everywhere. That is why you can render avatars in the browser today and move rendering to a Rust backend later without a single avatar changing.

Dig deeper ​