Images make a website look good. They show your products, your team, your work, and your premises in a way that words alone cannot. But images are also the most common reason a website loads slowly. A single photo straight from a camera can be several megabytes in size — far bigger than a web page needs — and a page full of such photos can take a long time to load, especially on a phone. Compressing your images before you upload them is one of the simplest and most effective things you can do for your website.
This guide explains what image compression means, how to do it without ruining the quality of your photos, and which mistakes to avoid. You do not need expensive software or technical skill. Most of it can be done with free tools in a few minutes.
Why large images slow your website down
When someone opens a page on your website, their browser must download every file on that page before it can display it properly. Text files are tiny. Images are not. A photo from a modern phone or camera is often 3 to 5 megabytes, and sometimes much more. A page with five such photos asks the visitor's browser to download 20 megabytes or more, which can take a long time on a mobile connection.
Slow pages lose visitors. People expect a website to load quickly, and if it does not, many of them will leave before they see anything at all. Slow pages also do badly in search results, because search engines prefer fast websites. And slow pages cost you money if you run advertising, because you pay to bring people to a page they leave before it loads.
Resize before you compress
The first step is to resize your image to the size it will actually be displayed at. If a photo will appear in a space that is 800 pixels wide on your website, there is no reason to upload a version that is 4000 pixels wide. The browser will shrink it to fit, but the visitor still has to download the full 4000-pixel file.
As a rough guide, a full-width banner image rarely needs to be wider than 1600 pixels, and most images inside a page are fine at 800 to 1200 pixels wide. A small thumbnail might only need 300 pixels. Check how wide the space is on your website, and resize the image to match it, with a little extra for sharpness on high-resolution screens.
Resizing is easy. Most computers have a built-in image editor that can do it, and there are many free online tools that resize images in a few clicks. Your website's media library may also create smaller versions automatically, but uploading a correctly sized original is still the best starting point.
Choose the right file format
Different image formats suit different kinds of pictures, and choosing the right one can make a big difference to file size.
- JPEG: the best choice for photographs and any image with lots of colours and detail. JPEG compression is designed for photos, and it can shrink a photo to a fraction of its original size with very little visible loss of quality.
- PNG: the best choice for images that need a transparent background, such as logos, and for simple graphics with sharp edges and flat colours. PNG files are usually larger than JPEG files for photographs, so do not use PNG for photos.
- WebP: a modern format that gives smaller files than JPEG or PNG at similar quality. Most modern browsers support it. If your website supports WebP, it is often the best choice, but keep a JPEG version as a fallback if you are unsure.
- SVG: the best choice for logos, icons, and simple illustrations. SVG files are code, not pixels, so they stay sharp at any size and are usually very small.
The most common mistake is uploading photographs as PNG files. A photo saved as PNG can be several times larger than the same photo saved as JPEG, for no visible benefit. If you take one thing from this guide, let it be this: photos should be JPEG, and graphics with transparency should be PNG.
How to compress an image without losing quality
Compression reduces the file size of an image by removing some of the information in it. There are two kinds. Lossless compression removes information that is not needed, without changing how the image looks at all. Lossy compression removes more information, including some detail that a careful eye might notice if it looks closely.
For most website photos, lossy compression at a sensible quality setting is the right choice. A JPEG saved at 70 to 80 percent quality looks almost identical to the original on a screen, but the file is much smaller. Dropping the quality below 60 percent usually starts to show visible problems, such as blocky patches in smooth areas of colour, so there is no need to go that low.
There are many free tools that compress images for you. Websites like TinyPNG, Squoosh, and Compressor.io let you drag in an image and download a smaller version in seconds. Image editing programs have a "save for web" option that does the same thing. WordPress also has plugins that compress images automatically when you upload them, which is convenient if you upload photos often. Whichever tool you use, compare the result with the original before you publish it, and check that it still looks good.
Frequently asked questions
Will compressing my images make them look worse?
Not if you do it sensibly. A photo compressed to 70 or 80 percent quality looks almost identical to the original on a screen, and most visitors will never notice the difference. The problems only appear when you compress too aggressively, so stick to a moderate quality setting and check the result before publishing.
What is the best free tool for compressing images?
For one-off images, free online tools like TinyPNG or Squoosh work well and need no installation. If you upload images often, a WordPress plugin that compresses images automatically on upload will save you time and make sure no large image ever slips through.
How small should an image file be?
As a rough guide, most images on a web page should be under 200 kilobytes, and many can be under 100 kilobytes. A large banner image might be a little bigger, but it should still be well under one megabyte. If an image is several megabytes, it is almost certainly too big for the web.
Should I delete the original full-size images?
Keep a copy of the originals on your own computer, in case you need a high-resolution version for print or for a redesign later. But do not upload the full-size originals to your website. Upload the resized, compressed version that matches how the image will actually be displayed.
Compressing your images is a small habit with a large payoff. Smaller images mean faster pages, happier visitors, better search results, and less wasted advertising money. Resize to the size you need, choose the right format, compress at a sensible quality, and check your existing images too. You can also read our guide on checking your website speed and our guide on checking your website on mobile phones to see the difference faster images make. If you would like a website that is fast from the start, with images handled properly throughout, contact Shehryar Noor — a web designer and developer since 2018 who has built more than 80 websites for small businesses — and get a website that loads quickly on every device.