DiceBear Avatars API
Free, no-key avatar generator with many styles from a seed string.
What it does
DiceBear generates deterministic avatars from a seed string across 20+ art styles (pixel-art, bottts robots, avataaars, identicon, initials, lorelei, notionists and more). The HTTP API returns SVG, PNG, WebP, JPEG or a JSON data URI, with dozens of style options as query parameters.
Base URL
Authentication
None. /{style}/svg?seed={seed} — e.g. /bottts/svg?seed=larzos. Swap svg for png/webp/jpg/json. Options: backgroundColor, radius, size, flip, rotate, plus style-specific ones.
Code examples
<img src="https://api.dicebear.com/9.x/identicon/svg?seed=user-482" alt="avatar"> <img src="https://api.dicebear.com/9.x/initials/svg?seed=Jane%20Doe&backgroundColor=00897b">
const url = `https://api.dicebear.com/9.x/lorelei/svg?seed=${encodeURIComponent(user.id)}`;
avatarImg.src = url; // same user -> same avatar, foreverRate limits & quotas
No key and no documented hard rate limit on the hosted API, but for high volume the project recommends self-hosting (npm packages or a Docker image) or generating avatars at sign-up and caching the result. Responses are cache-friendly; set a long TTL.
Key response fields
| (svg/png/…) | The avatar image in the requested format |
| (json) svg | The SVG markup as a string |
| (json) extra | Resolved options used to generate it |
| seed | Any string — identical seed + style + options = identical avatar |
Common errors
| 404 | Unknown style name — check the style list (note the 9.x version prefix). |
| 400 | Invalid option value (e.g. a non-hex backgroundColor). |
| (version drift) | Pin the major version in the path (9.x) — new majors can change output. |
When to use it (and alternatives)
The best free way to give every user a unique, consistent avatar without uploads — forums, dashboards, comment threads. For initials-only avatars UI Avatars is simpler; for robot/monster art, RoboHash.
FAQ
How do I make avatars stable per user?
Use a stable value as the seed — a user id or hashed email, not their display name (which can change). Same seed + style always renders the same avatar.
SVG or PNG?
SVG is smallest and scales perfectly — use it in web UIs. Use PNG/JPEG for emails or contexts that don’t render SVG.
Should I hotlink the hosted API in production?
For modest traffic it is fine. For scale, generate the avatar once at sign-up (self-hosted lib or a single API call) and store the SVG/URL yourself.
New to APIs?
Short guides for working with this API — and any other.