UI Avatars API
Generate simple initials-based avatar images from a name — no key.
What it does
UI Avatars generates a simple avatar image from a person’s name — their initials on a coloured circle or square. Everything is controlled by query parameters; there is no upload and no account.
Base URL
Authentication
None. /?name=John+Doe plus options: size, background (hex or random), color, rounded, bold, length (initials count), format (png or svg).
Code examples
<img src="https://ui-avatars.com/api/?name=Ada+Lovelace&background=6d28d9&color=fff&rounded=true"
alt="Ada Lovelace">const avatar = `https://ui-avatars.com/api/?name=${encodeURIComponent(user.fullName)}`
+ `&background=random&size=96&format=svg`;
img.src = avatar;Rate limits & quotas
No key, no documented rate limit. Images are cacheable — the URL fully determines the output, so a CDN or browser cache handles repeat views. background=random picks a colour deterministically from the name, so the same name gets the same colour.
Key response fields
| (png/svg) | The avatar image |
| name | One or more words — initials are taken from the first and last |
| length | How many initials (default 2) |
| background / color | Circle fill and text colour (hex without #, or random) |
Common errors
| (no initials) | An empty or symbol-only name yields a blank avatar — validate first. |
| (hash with #) | Pass colours without the leading #. |
| (name not URL-encoded) | Encode spaces (+ or %20) or the parameter parsing breaks. |
When to use it (and alternatives)
The quickest way to fill an avatar slot when you only have a name — contact lists, team pages, comment threads. For distinctive generative art per user use DiceBear; for placeholder photos, Lorem Picsum.
FAQ
Can the colour be consistent per user?
Yes — background=random derives the colour from the name hash, so the same name always gets the same colour. Or set a fixed background.
PNG or SVG?
SVG is crisp at any size and tiny. Use PNG where SVG isn’t supported (some email clients).
How do I show one initial instead of two?
&length=1. Useful for very small avatars.
New to APIs?
Short guides for working with this API — and any other.