JPG for Web

Complete guide to optimizing JPG images for websites — compression, sizing, performance, and modern best practices.

Recommended Image Sizes

Use CaseMax WidthQualityTarget Size
Hero/Banner1920px80-85150-300 KB
Content Images1200px80-8580-150 KB
Blog Thumbnails600px75-8030-60 KB
Product Images800px85-9050-100 KB
Thumbnails300px70-7510-25 KB

Web Optimization Checklist

  1. Resize before upload — Don't upload 4000px images for 800px display
  2. Compress to 80-85 quality — Sweet spot for quality vs size
  3. Use progressive JPG — Loads visually faster
  4. Strip metadata — Remove EXIF data (saves 10-50KB)
  5. Implement lazy loadingloading="lazy"
  6. Use responsive images — srcset for different screen sizes
  7. Consider WebP — 25-35% smaller with same quality

JPG vs WebP vs AVIF

FormatSizeBrowser SupportBest For
JPGBaseline100%Universal fallback
WebP25-35% smaller97%Modern browsers
AVIF50% smaller85%Cutting-edge

Recommendation: Serve WebP with JPG fallback using <picture> element.

Responsive Images Code

Serve different sizes based on screen:

<img 
  src="image-800.jpg"
  srcset="image-400.jpg 400w,
          image-800.jpg 800w,
          image-1200.jpg 1200w"
  sizes="(max-width: 600px) 400px,
         (max-width: 1200px) 800px,
         1200px"
  alt="Description"
  loading="lazy"
>

Best Compression Tools

Core Web Vitals Impact

Properly optimized images improve:

Always include width and height:

<img src="photo.jpg" width="800" height="600" alt="...">

More JPG Guides