HomeBlogHow to Compress Images for a Faster Website Without Losing Quality
Tips & TricksNovember 3, 20265 min read

How to Compress Images for a Faster Website Without Losing Quality

Oversized images are the most common reason pages load slowly. This guide shows how to resize, compress and convert images so they look sharp but download quickly.

Here is a pattern we see constantly: a small business uploads photos straight from a phone to its homepage. Each one is 4032 by 3024 pixels and around 4 MB. The page displays them in a column 800 pixels wide. Visitors on mobile data download roughly 20 times more image data than they can actually see, and the page takes several seconds to become usable.

Images are usually the heaviest part of a web page, so they are also where the biggest, easiest performance gains are. The goal is not to make images look worse. It is to stop sending pixels and bytes that nobody can see. This guide covers the three levers you control: dimensions, compression and format.

Why image weight matters

Google's Core Web Vitals include Largest Contentful Paint (LCP), which measures how long it takes for the main content of a page to appear. On many pages, that main element is a hero image. Google considers an LCP of 2.5 seconds or less to be good. A 4 MB hero image on a typical mobile connection can blow through that budget on its own.

Beyond search rankings, slow pages simply lose people. Visitors on phones, older devices, or metered data plans feel every extra megabyte.

Step 1: Resize to the size you actually display

Resizing is the single most effective step, because file size scales with the number of pixels. Halving both the width and height of an image removes three quarters of its pixels.

Work out the largest size an image will appear on screen, then allow for high-density (Retina) displays by doubling it:

  • A blog image shown at most 800 pixels wide: export at around 1600 pixels wide.
  • A full-width hero banner: 1920 to 2560 pixels wide is usually plenty.
  • A thumbnail shown at 300 pixels: 600 pixels wide is enough.

Our image resizer lets you type an exact width and height with the aspect ratio locked, so changing one value updates the other automatically. It also has presets for common sizes such as Full HD (1920 by 1080), Instagram (1080 by 1080) and Facebook link images (1200 by 630). One caution: presets set an exact width and height and unlock the aspect ratio, so a photo with a different shape will be stretched. For ordinary photos, it is usually better to enter the width yourself and let the height follow.

Step 2: Compress with a sensible quality setting

Lossy formats such as JPG and WebP let you choose a quality level, typically on a scale up to 100. The relationship between quality and file size is far from linear. Dropping from 100 to around 80 often cuts the file size by half or more, while the visual difference is very hard to spot. Below about 60, artifacts start to appear: blockiness in smooth areas like skies, and halos around sharp edges and text.

A practical approach:

  1. Start at quality 80 for photos.
  2. Compare the compressed version with the original at 100% zoom, focusing on faces, gradients and any text.
  3. If it looks identical, try 70. If you can see artifacts, go back up to 85.
  4. Use the same setting for similar images so your site looks consistent.

Our image compressor is built around this workflow. It runs entirely in your browser and offers three controls: a maximum file size target (0.1 to 10 MB, default 1 MB), a maximum dimension for the longest side (100 to 4096 pixels, default 1920), and a quality setting (default 80%). You can drop in up to 20 images of up to 25 MB each, see the before-and-after sizes side by side with the percentage saved, and download them individually or all at once.

The compressor keeps each file in its original format. JPGs and WebPs are compressed by lowering quality. PNG has no quality setting of its own, so PNG files are reduced mainly by limiting the number of colors and, if needed to reach the size target, by scaling them down. If a PNG is actually a photo, converting it to JPG or WebP will usually save far more.

Step 3: Use a modern format

WebP produces smaller files than JPG at similar visual quality, and it supports transparency, so it can also replace many PNGs. Google's own measurements put lossy WebP at roughly 25-34% smaller than comparable JPGs. Every current major browser supports it.

The JPG to WebP converter handles batches of up to 20 images with an adjustable quality slider. A useful order of operations is: resize first, then convert to WebP at quality 75-85, then check the result. If you are unsure which format suits a particular image, our guide to choosing between JPG, PNG, WebP and GIF goes through the trade-offs.

A worked example

Here are typical numbers for a single phone photo prepared for a blog post. Exact results vary with the content of the image; a busy, detailed scene compresses less than a plain background.

StageDimensionsApproximate size
Original from phone (JPG)4032 x 30243.5-5 MB
Resized1600 x 1200600-900 KB
Resized, JPG quality 801600 x 1200250-400 KB
Resized, WebP quality 801600 x 1200150-300 KB

That is roughly a 90-95% reduction, and on a normal laptop screen most people would not be able to tell the final version from the original.

Don't forget the HTML

A well-compressed image can still hurt performance if it is embedded carelessly. A few habits help:

  • Set width and height attributes on your image tags so the browser reserves space before the image loads. This prevents content from jumping around, which is measured by another Core Web Vital, Cumulative Layout Shift.
  • Lazy-load images below the fold with loading="lazy", so the browser only downloads them when they are about to scroll into view. Do not lazy-load your main hero image, as that delays LCP.
  • Serve different sizes to different screens using the srcset and sizes attributes, so phones do not download desktop-sized images. The MDN guide to HTML images explains the syntax.

Common mistakes to avoid

  • Compressing the same JPG repeatedly. Each lossy save degrades the image a little. Always work from the original.
  • Saving photos as PNG. It is lossless, but a photo saved as PNG is often several times larger than a good JPG or WebP.
  • Relying on CSS to shrink images. Setting an image to display at 400 pixels wide does not reduce the number of bytes downloaded.
  • Over-compressing logos and text. Graphics with sharp edges show artifacts quickly. Keep them as PNG or lossless WebP, or use SVG where possible.

Wrapping up

Resize to the largest size you actually display, compress photos to around quality 80, and use WebP where you can. Those three steps alone typically cut image weight by 80% or more without any visible loss. Keep your full-size originals in a separate folder so you can always re-export if your layout changes.

imagescompressionweb performancewebpresize
How to Compress Images for a Faster Website