Avatar Generator
Create beautiful avatar components with initials, images, status indicators, and more
Avatar Type
Name
Shape
Size
Colors
Status Indicator
Border
Shadow
Avatar Group
Preview
Size Comparison
XS
SM
MD
LG
XL
2XL
3XL
Common Use Cases
User Profile
Comment
Chat
Navigation
CSS
.avatar {
display: inline-flex;
align-items: center;
justify-content: center;
width: 48px;
height: 48px;
background-color: #22c55e;
color: #ffffff;
font-size: 16px;
font-weight: 600;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
border-radius: 50%;
position: relative;
overflow: hidden;
user-select: none;
flex-shrink: 0;
}
.avatar img {
width: 100%;
height: 100%;
object-fit: cover;
}
.avatar svg {
width: 24px;
height: 24px;
}HTML
<div class="avatar">
JD
</div>React Component
import './Avatar.css';
function Avatar({ name, src, icon, status, size = 48 }) {
const getInitials = (fullName) => {
if (!fullName) return '?';
const names = fullName.trim().split(' ').filter(Boolean);
if (names.length === 1) return names[0].charAt(0).toUpperCase();
return (names[0].charAt(0) + names[names.length - 1].charAt(0)).toUpperCase();
};
return (
<div className="avatar" style={{ width: size, height: size }}>
{src ? (
<img src={src} alt={name} />
) : icon ? (
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
{/* Icon path here */}
</svg>
) : (
getInitials(name)
)}
{status && status !== 'none' && (
<span className={`avatar-status avatar-status--${status}`} />
)}
</div>
);
}
export default Avatar;Avatar Best Practices
Design
- Use consistent sizing throughout your app
- Circle shapes are most common for user avatars
- Rounded squares work well for team/org avatars
- Ensure sufficient contrast between text and background
Initials
- Use first and last initial for recognizability
- Generate colors from names for consistency
- Single letter for very small sizes (under 24px)
- Consider font weight for better readability
Images
- Always provide a fallback (initials or icon)
- Use object-fit: cover for proper cropping
- Lazy load avatars in long lists
- Provide alt text for accessibility
Status Indicators
- Use universally understood colors (green=online)
- Position consistently across your app
- Add white border for visibility on any background
- Consider adding aria-label for accessibility
Need Custom UI Components?
Our team can design and build a complete design system for your application, including custom avatars, components, and more.
Hire Brix340