API Directory › 🔧 Utilities & Media › UI Avatars
No authHTTPSCORS

UI Avatars API

Generate simple initials-based avatar images from a name — no key.

Auth
No auth needed
HTTPS
Yes
CORS
Yes
Open UI Avatars docs ↗

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

https://ui-avatars.com/api

Authentication

None. /?name=John+Doe plus options: size, background (hex or random), color, rounded, bold, length (initials count), format (png or svg).

Code examples

HTML
<img src="https://ui-avatars.com/api/?name=Ada+Lovelace&background=6d28d9&color=fff&rounded=true"
     alt="Ada Lovelace">
JavaScript
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
nameOne or more words — initials are taken from the first and last
lengthHow many initials (default 2)
background / colorCircle 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.

🛠️ Handy LarzOS tools

Free tools to help you work with this API.

QR GeneratorImage Compressor

Related Utilities & Media APIs

← Back

More Utilities & Media APIs · All 196 APIs