🗜️Image

How to Compress Images for Faster Websites

Practical image compression for web developers and content creators. Which settings to use, what to avoid, and how to automate it for your workflow.

6 min readNovember 8, 2025By FreeToolKit TeamFree to read

Images are the number one cause of slow websites. They're also the easiest performance win available, and the optimization that requires the least technical knowledge. Yet most websites still serve images that are 3-5x larger than necessary.

The Simple Math

A 4MB hero image that displays at 1200x600px on the website has about 3.7MB of wasted data — because 1200x600px at 2x for Retina only needs about 400KB. Multiply by the 8-12 images on a typical homepage and you're sending 30MB instead of 4MB. That's a real user impact: on a 10 Mbps connection, 30MB takes 24 seconds to load.

The Three Things to Compress

  • Dimensions: Resize to the largest size at which the image will be displayed (accounting for Retina: 2x display size). A 1200px-wide image on a 600px container means a 1200px image, not 4000px from your camera.
  • Format: Convert JPEG/PNG to WebP. WebP is 25-35% smaller at equivalent quality with 97%+ browser support.
  • Compression: Reduce the quality setting in your export. JPEG at 80 looks nearly identical to JPEG at 100 and is 60% smaller.

For Developers: The <picture> Element

Serve WebP to browsers that support it, JPEG as fallback: the picture element handles this elegantly.

Example

<picture>
  <source srcset="image.webp" type="image/webp">
  <img src="image.jpg" alt="Description" width="1200" height="600">
</picture>

Batch Compression Tools for Workflow

  • Our online compressor: Best for one-off compression and quick checks.
  • Sharp (Node.js): Best for programmatic batch processing and build pipelines.
  • ImageOptim (Mac): Drag-and-drop batch compression, good quality preservation.
  • Squoosh (Google): Browser-based, good for comparing formats and settings side by side.
  • Cloudinary / Imgix: CDN-based image optimization — serve different sizes and formats automatically based on the requesting device.

The Lazy Loading Default

Add loading="lazy" to all img tags below the fold. Modern browsers defer loading these images until the user scrolls near them, reducing initial page weight significantly. Exception: the hero image or LCP element (the main visible image on load) should not be lazy-loaded — it should be loaded immediately and ideally preloaded.

Frequently Asked Questions

What image quality setting should I use for web?+
For JPEG: 75-85 is the sweet spot. Below 70 shows visible artifacts on photographs; above 90 gives diminishing returns with significantly larger file sizes. For WebP: 75-80 is typical, producing smaller files than JPEG at equivalent visual quality. For PNG: quality settings don't apply (it's lossless) — instead, use PNG-8 (256 colors) for images with limited color ranges and PNG-24 only when you need full color depth with transparency.
Should I compress images before or after uploading to WordPress?+
Both, ideally. Compress before uploading (using our tool or Photoshop) to ensure the original file is optimized. Then let WordPress or an image optimization plugin (ShortPixel, Imagify, Smush) handle the thumbnails and additional sizes it generates. If you only do one, compress before uploading — it affects the original and all generated sizes.
What image dimensions should I use for blog posts?+
For the featured image in a typical blog layout (1000-1200px wide content area): 1200-1600px wide is sufficient. Going higher than 2x the display width wastes bandwidth without visible benefit on normal screens — though 2x is helpful for Retina displays. Always set the width and height HTML attributes even for responsive images so the browser can reserve layout space before the image loads.
Can I compress images without losing visible quality?+
Yes, for most web use cases. The transition from 'invisible' to 'visible' quality loss happens at different compression levels depending on the image content. High-frequency detail images (grass, hair, fabric textures) show artifacts sooner. Images with smooth gradients and flat colors (product photos on white backgrounds) can be compressed more aggressively without visible loss. Always visually compare at your target display size, not 100% zoom.

🔧 Free Tools Used in This Guide

FT

FreeToolKit Team

FreeToolKit Team

We build free, privacy-first browser tools and write practical guides that skip the fluff.

Tags:

imagecompressionweb-performanceoptimization