Skip to content

Technical SEO

How to Compress Images for the Web Without Losing Quality

By Shayan Ahmad · · 6 min read

How to Compress Images for the Web Without Losing Quality (WhiteLinko blog banner)

Large images are still one of the most common reasons a page feels slow. The good news is that you can usually cut the file size a long way without the photo looking worse on a phone or a laptop. This is a practical guide to format, dimensions, compression and lazy-loading, in that order.

Start With the Display Size, Not the File Type

Compression cannot save a photo that is far bigger than it needs to be. If a product image is shown at 800 pixels wide, a 4,000-pixel original is doing no visible work. It is only adding weight.

Before you compress anything, resize the image to the largest size it will actually be displayed, with a little room for high-density screens. A common, simple approach is to export at twice the CSS width for retina displays, and no more. A hero that is 1,200 pixels wide on screen can be exported around 2,400 pixels wide. A thumbnail that is 200 pixels wide does not need a 2,000-pixel file.

If your content management system or store platform creates several sizes from one upload, that is helpful, but only if the page actually requests the right size. A theme that always loads the largest file into a small slot is a frequent cause of slow category pages. Check one product grid in the network panel and see which image files are being downloaded. If they are much wider than the on-screen slot, fix the theme or the image settings first.

Choose a Modern Format: WebP and AVIF

JPEG and PNG still work, but they are usually heavier than they need to be. Two newer formats are worth knowing.

  • WebP is widely supported and typically produces a smaller file than JPEG at a similar visual quality. It also handles transparency, so it can replace many PNGs.
  • AVIF often goes further still, especially on photographs, but support and encoding time can vary. Use it when your platform or CDN offers it reliably, with a fallback.

You do not have to convert your whole library by hand. Many CDNs, image CDNs and modern platforms can transcode on the fly and serve WebP or AVIF to browsers that accept them, while keeping a JPEG or PNG fallback. If your platform cannot do that, batch-converting the largest images to WebP is still a useful step.

Keep PNG for graphics that need sharp edges and a simple transparent background, such as logos and icons, unless a WebP or SVG version is clearly smaller and just as sharp. Do not convert a tiny icon set if the savings are negligible. Spend your effort on heroes, category banners and product photographs, because that is where the bytes are.

Compress Without Making the Image Look Soft

Once the dimensions and format are right, compression is a quality setting, not an on/off switch. The aim is the smallest file that still looks clean at its real display size, on a phone as well as on a desktop.

A practical way to do this:

  1. Export a candidate at a reasonably high quality setting.
  2. Compare it with the original at the size it will appear on the site, not at 100% in an image editor. Zoomed-in editor views make tiny artefacts look worse than they are.
  3. Lower the quality in steps until you can see a problem in the areas that matter: faces, product edges, text in the image, large flat areas of colour.
  4. Step one setting back up and use that.

There is no single quality number that is always right, because a busy product photo and a soft lifestyle background compress differently. Trust your eye at the real size. If you use a plugin or an app to compress on upload, look at a sample of live pages afterwards. Automatic tools sometimes over-compress, especially on images that contain text or fine patterns.

For a store, this work is worth doing properly on the images people see first. On a US vaporizer Shopify store we worked with, product and category page improvements, including the way those pages were built and presented, helped grow sales 20% to $113,201 between January and April 2026 with $0 ad spend. File size alone did not produce those figures, but heavy product images are often part of what holds a catalogue page back. The full story is in the vaporizer brand case study.

Lazy-Loading, Used Carefully

Lazy-loading tells the browser not to download an image until it is close to being visible. That is useful on long pages with many photos, such as category grids and articles. It is not useful on the first image people see.

The hero, the main product image above the fold, and the logo in the header should load normally. If you lazy-load those, you can delay the largest contentful paint and make the page feel slower, even if the total page weight looks better in a report. Native lazy-loading with the loading attribute is usually enough. You do not need a heavy JavaScript library for this on a modern site.

There is more to get right with lazy-loading, especially around what Google can see, and that is worth a separate look. For this article, the simple rule is: lazy-load the images below the first screen, and leave the first, important ones alone.

You should also set width and height, or an aspect-ratio, so the page does not jump as images appear. That is a user experience issue as much as a speed one, and it is easy to forget when you are focused on file size.

A Simple Workflow You Can Repeat

If you do not want this to become a one-off cleanup that slowly undoes itself, use a short routine every time you add a new image.

  • Crop and resize to the real display size, with a modest allowance for high-density screens.
  • Export as WebP where you can, or let your CDN do the conversion, with a sensible fallback.
  • Compress until the live size looks clean, then stop.
  • Give the file a descriptive name before you upload it. That helps humans and does no harm for search.
  • Add useful alt text, and lazy-load only if the image is not the first thing on the page.

Then measure. A lab test in our page speed checker or in PageSpeed Insights is a good before-and-after check on a homepage and a heavy category page. Look at the image bytes transferred and at Largest Contentful Paint, not only at a single score. Speed work of this kind is part of everyday technical SEO, and it is often the fastest visible improvement you can make on an image-heavy site.

If you run an online store, combine this with the rest of your on-page work rather than treating images as a separate project. Our e-commerce SEO service includes the template and speed issues that stop category and product images loading cleanly. You can also compare how different teams handle this kind of technical work in our note on technical SEO compared with Peak Ace.

FAQs

Will compressing images hurt my image search traffic?

Not if the picture still looks sharp at the size it is shown. Search is not rewarding the heaviest file. Over-compression that makes a product look soft or blocky can hurt the page for people, which is a bigger problem than a slightly smaller file.

Should I replace every JPEG on the site at once?

Start with the images on your most important and most visited templates: the homepage, top category pages and best-selling products. A full library rewrite is rarely the best first step, especially if new uploads will still be oversized.

Is AVIF always better than WebP?

Often it is smaller, but not always, and not every toolchain handles it well yet. WebP is the safer default if you have to pick one modern format today. Use AVIF when your platform serves it reliably with a fallback.

Do I need an image compression app?

Only if it saves you time and the results still look good. Many platforms and CDNs already compress and convert on delivery. An extra app is useful when that is missing, but it should not be a substitute for uploading a reasonably sized original.

Want Your Heaviest Pages Checked?

If your homepage or category pages still feel slow after you have resized a few images, the cause is often a theme that requests the wrong file, or a hero that is being lazy-loaded by mistake. I can look at the live pages and tell you what to fix first. Request a free SEO audit and we will go through it together.

  • image compression
  • webp
  • avif
  • page speed
  • lazy loading

Have a question about this for your own site?

A 15-minute call is usually enough to tell whether it applies to you and what to do first.

Book a 15-min callGet My Free SEO Audit

Related posts

All blog posts →

Talk to WhiteLinko

Want this applied to your site?

Book a 15-minute call to talk through your goals, or start with a free SEO audit: a prioritised list of fixes, reviewed by a specialist.

Free PDF · 2026 edition

The WhiteLinko SEO Checklist

Six pages of tick boxes: technical, on-page, content, local, links, AI search and GA4.

Get the checklist
Free SEO Audit