Base64 in HTML <picture>

The <picture> element can offer a modern format (AVIF/WebP) with a PNG fallback, all embedded as Base64.

Example

<picture>
  <source type="image/webp" srcset="data:image/webp;base64,UklGRiQAAABXRUJQVlA4..." />
  <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAK..." alt="Logo" />
</picture>

Notes

  • Every alternative is downloaded as part of the HTML, so this only makes sense for very small images.

Other HTML tags

Related tools and guides

Comments (0)

Questions, ideas or a bug in “Base64 in HTML <picture>”? Leave a comment, rate the tool, or reply to others.

No comments yet. Be the first to share your feedback!

Leave a comment

Rate this tool:
Esc
↑ ↓ move↵ openEsc close