Picture Tag Builder
Builds a <picture> tag with multiple <source> (modern formats like webp, avif) and an <img> fallback.
Picture tag with AVIF, WebP and fallback
You exported the same photo as avif, webp and jpg to save bandwidth, and now you have to recall the picture and source syntax, which format goes first, and where alt and classes belong. Getting the order wrong throws no error at all: the browser quietly serves the heaviest file while you assume the optimization landed.
The browser reads the sources top to bottom and stops at the first type it can decode, falling back to the img if none match. That is why the tool writes avif first, webp next and img last, smallest format to most compatible one. Leave the avif or the webp field blank and that line simply does not appear in the output.
The img is not just the backup plan, it is the element that actually renders, so width, height, classes and loading equals lazy all belong there rather than on picture. Adding width and height reserves the space and keeps the page from jumping. The alt text is copied verbatim, so a double quote inside it will break the attribute. Art direction, meaning a different crop per breakpoint, needs a media attribute on each source, which this form does not write.
Frequently asked questions
Does the source order really matter?
I only have webp and jpg. Now what?
Where do class, width and loading go?
Related Tools
HTML Video Embed Builder
Builds an HTML5 <video> tag with source, controls, poster, autoplay and loop options.
Img Srcset Builder
Builds an <img> tag with a responsive srcset from URLs and widths, ideal for fluid images.
Subtractive Color Mixer (CMY, Hex Output)
Mixes two hex colors the way ink does, keeping the lowest R, G and B value of each pair, so yellow ffff00 with cyan 00ffff returns green 00ff00.
Map Route Planner
Create routes by adding waypoints on an interactive OpenStreetMap. View total distance in km and export points as CSV.
Color Blindness Simulator
See how an image appears to people with protanopia, deuteranopia, tritanopia or achromatopsia. Accessibility tool for designers and developers.
YouTube Embed Builder
Builds a YouTube embed <iframe> from the video ID with customizable width and height.