JPEG Compression in 2025: Best Practices & New Formats
Updated: 2025-10-18
JPEG has been the workhorse of web imagery for decades, but the landscape is changing. In 2025, designers and developers have a wealth of choices—from modern JPEG encoders that squeeze out every unnecessary bit to next‑generation formats like WebP and AVIF that offer dramatically better compression. This guide explores how to get the most out of JPEG today and when it makes sense to switch formats.
Why care about JPEG compression?
File size still dictates loading speed and user experience. Large images block rendering and inflate bandwidth costs. Studies show that compressing images reduces data transfer and initial load times【413330301302362†L87-L94】. Yet not all compression is equal—choosing the right encoder and tuning quality settings can yield significant savings while maintaining visual fidelity. In 2025, the competition from new formats makes it even more important to understand JPEG’s place.
Modern JPEG encoders
Standard JPEG libraries often leave performance on the table. Tools
like mozjpeg and libjpeg-turbo implement
advanced techniques such as trellis quantisation, progressive
encoding and optimized Huffman tables. These methods can
reduce file sizes by up to 10‑20 % compared to baseline encoders
without any perceptible quality loss. Progressive JPEGs also
improve perceived load time by displaying a low‑quality preview
before downloading the full image.
When compressing manually, start with quality values around 75–80
and iterate. Inspect at 100 % zoom to spot banding or noise in
smooth gradients. For photographic images with a lot of detail,
a slightly higher quality (85) may be necessary, while UI
elements can often be compressed to 60–70. Remove unnecessary
metadata (EXIF, thumbnails) with tools such as exiftool
to shave off additional kilobytes.
Next‑generation formats: WebP and AVIF
If you’re serious about performance, you shouldn’t stop at JPEG. Google’s WebP and the newer AVIF format can yield far better compression. The official WebP study found that WebP files are approximately 25–34 % smaller than equivalent JPEGs at the same structural similarity index【171508693852780†L241-L290】. A 2025 comparison by SpeedVitals notes that WebP images are 25–34 % smaller than JPEG and that AVIF can be ~50 % smaller【221654481411971†screenshot】.
AVIF extends this further. It uses the AV1 video codec’s modern compression algorithms to deliver superior rate–distortion performance. As of September 2025, both WebP and AVIF are widely supported in browsers, although WebP still has a slightly higher adoption rate (about 95 %) compared to AVIF’s 93.8 %【111889046720395†screenshot】. AVIF often requires more processing power to encode and decode but its smaller files can offset the slower decoding times【401814846636866†screenshot】.
Recommended implementation
Use the <picture> element to deliver multiple
formats. Serve an AVIF source first, then WebP, and fall back to
JPEG. Include explicit width and height
attributes to prevent layout shifts and set
fetchpriority="high" for critical hero images【483188929336708†L150-L176】.
JPEG in a world of AVIF and WebP
JPEG isn’t dead. It remains a reliable fallback for older
browsers and workflows that cannot yet produce AVIF or WebP. It’s
also still useful for progressive loading sequences. When using
JPEG as a fallback, pair it with a modern encoder and restrict
image widths to the maximum size needed on your site. Use responsive
image techniques (srcset and sizes) to
avoid serving unnecessary pixels to mobile users【483188929336708†L150-L176】.
Actionable best practices
- Choose the right format: AVIF for photos,
WebP as a broad fallback, JPEG as a last resort. Use
<picture>to serve the best variant.【483188929336708†L29-L43】 - Tune quality wisely: Start at 80 and adjust according to visual inspection. Use perceptual metrics like SSIM to find the sweet spot.
- Strip metadata: Remove EXIF data and color profiles unless absolutely required; this can reduce file size by several kilobytes.
- Resize images: Never serve images larger than the display size. Use responsive images to adapt to different screens.
- Automate the process: Integrate
optimisation into your build pipeline using tools like
imagemin,sharpor cloud services that can generate AVIF and WebP on the fly.
Conclusion
In 2025, JPEG remains relevant but it’s no longer the default choice for performance‑conscious sites. Modern encoders squeeze more out of JPEG, but the biggest gains come from adopting next‑generation formats like WebP and AVIF. By following the practices outlined above—choosing the right encoder, tuning quality settings, stripping metadata and delivering responsive variants—you can provide crisp visuals without sacrificing speed.