Skip to main content

Image Optimization Calculator

Enter your image details to estimate optimization savings, compare formats, and get recommended HTML attributes for performance. See how format changes and quality tuning affect file size and LCP.

✓ JPEG / WebP / AVIF comparison ✓ LCP impact estimate ✓ HTML snippet generator

Image Details

75–85 recommended for photos
Quick Scenarios

Frequently Asked Questions

What image format should I use for web images?▼

For photographs: AVIF is best (50%+ smaller than JPEG), followed by WebP (25–35% smaller). Fall back to JPEG. For graphics, logos, icons: WebP with transparency or SVG. For animations: WebP or AVIF (both support animation, much smaller than GIF). PNG for lossless screenshots. Use the HTML picture element with multiple source elements to serve the best format each browser supports, with JPEG/PNG as fallback.

What is the difference between lossy and lossless compression?▼

Lossy compression (JPEG, WebP lossy, AVIF) permanently discards some image data to achieve smaller files. The quality setting controls the trade-off: lower quality = smaller file but more artifacts. Quality 75–85 is usually the sweet spot for photos — visually indistinguishable from the original. Lossless compression (PNG, WebP lossless) preserves all data but achieves less compression. Use lossy for photos, lossless for screenshots, UI elements, and images with text.

How do I implement responsive images with srcset?▼

Use the srcset attribute with width descriptors: <img srcset='img-400.webp 400w, img-800.webp 800w, img-1200.webp 1200w' sizes='(max-width: 600px) 400px, (max-width: 1024px) 800px, 1200px' src='img-800.webp' alt='...' width='1200' height='600'>. The browser picks the most appropriate size based on device width and pixel density. Always include the sizes attribute so the browser can calculate the correct source before layout.

What does lazy loading do and when should I use it?▼

Lazy loading (loading='lazy') defers image loading until the image is about to enter the viewport. This reduces initial page weight and speeds up LCP for above-the-fold content. Use it on all below-the-fold images. Never use it on the LCP image (hero image) — that would delay your most important metric. Modern browsers support native lazy loading; no JavaScript needed. For older browser support, use an Intersection Observer-based library as fallback.

What is Image CDN and how does it help performance?▼

An Image CDN (Cloudinary, Imgix, Cloudflare Images, Vercel Image Optimization) automatically resizes, compresses, and converts images to the optimal format based on the requesting device. Instead of serving a 2MB 4K photo to a mobile phone, the CDN serves a 50KB WebP at the appropriate resolution. URL-based transformations: ?w=800&f=webp&q=80. This eliminates manual image processing, saves bandwidth, and dramatically improves LCP. Most modern hosting platforms include image optimization.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →