When a user has not uploaded a profile photo, an identicon gives them a unique visual identity for free. This generator turns any string into a clean, symmetric geometric avatar that is identical every time for the same input.
How it works
The seed string is hashed with FNV-1a, a fast 32-bit non-cryptographic hash:
hash = 0x811c9dc5
for each char:
hash = hash XOR charCode
hash = hash * 0x01000193 (32-bit)
The hash drives two things. First, hash mod 360 becomes the avatar’s hue, kept
at a fixed saturation and lightness so colors stay legible. Second, the bits of
the hash (further mixed per cell) fill a 5x5 grid. Only the left three columns
are decided independently; columns four and five mirror columns two and one, so
the result is always left-to-right symmetric. The filled cells are drawn as
colored squares on your chosen background and exported as a crisp, scalable SVG.
Why identicons instead of initials or placeholder icons
Initials avatars (a colored circle with the user’s first letter) are common, but they have a collision problem: every user named “Alice”, “Aaron”, and “Amara” gets the same-looking placeholder. Identicons sidestep this entirely — even two users whose names start with the same letter get visually distinct avatars because the full seed string is hashed, not just the first character.
Compared with random avatar images, identicons are:
- Deterministic — the same seed always produces the same avatar, so avatars stay consistent without image storage.
- Lightweight — an SVG identicon is typically a few hundred bytes, dramatically smaller than even a tiny PNG.
- Distinguishable at small sizes — the 5×5 symmetric grid creates recognizable patterns even at 20×20 pixels, which is important for comment threads and notification lists.
GitHub popularized this style (their “Identicons” are also hash-driven symmetric grids), which is why users broadly accept them as a credible default.
Choosing the right seed
The seed you choose determines how stable the avatar is:
- User ID or UUID — best choice. IDs never change, so the avatar is perfectly stable.
- Lowercased, trimmed email — reliable for most cases, but the avatar changes if the user updates their email.
- Username or display name — avoid if the platform allows name changes, because the avatar silently shifts when the name does.
Store the seed (not the image) in your database and regenerate the SVG at render time. Because the computation is instant in JavaScript, there is no performance cost to on-demand generation.
Notes and tips
Because the avatar is pure SVG, it scales to any size without blurring and stays tiny in file size. For best results, seed with a stable identifier such as a user ID or a lowercased, trimmed email rather than a display name that might change. You can store just the seed in your database and regenerate the avatar on demand, avoiding image storage entirely. Pair the auto-derived colors with a neutral background like light gray for a polished, app-ready look.