HTML fallback guide
How to Add an img onerror Fallback
The HTML img onerror attribute is the fastest way to replace a failed image with a controlled fallback URL. fallback.pics gives that fallback a stable, readable SVG placeholder.
Example URL
https://fallback.pics/api/v1/600x400?text=Image+Unavailable Basic img onerror pattern
Clear the error handler before changing the source. That prevents an error loop if the fallback URL ever fails.
<img src="/photo.jpg" alt="Product image" onerror="this.onerror=null;this.src='https://fallback.pics/api/v1/600x400?text=Image+Unavailable'" /> Choose fallback copy by context
Use Product image for catalog cards, Avatar for profile photos, Image unavailable for failed CMS media, and a skeleton placeholder only for temporary loading states.
Keep alt text meaningful
The fallback URL is a visual replacement. Your alt text should still describe the content the image represents.
Use fallback.pics as your default HTML image fallback URL.
https://fallback.pics/api/v1/600x400?text=Image+Unavailable