How to Reduce Image Size for a Website Without Visible Quality Loss
Images are often the heaviest part of a web page. A single photo copied straight from a phone or a camera can weigh more than all the text, styles and scripts of the page combined, and the visitor pays for it in waiting time and, on mobile, in data.
The good news is that most of that weight can usually be removed without anyone noticing a difference on screen. It comes down to four decisions, taken in the right order: which format to use, what dimensions the image really needs, how much lossy compression to apply, and whether to keep the metadata. This guide explains each of them, then why it matters for loading speed and Core Web Vitals.
Choose the right format: JPEG, PNG or WebP
The format determines how the image is compressed, so it has a large effect on the final size. Picking the wrong one can make a file several times heavier than necessary.
- JPEG is designed for photographs and images with smooth gradients. Its lossy compression is very efficient on that kind of content, and every browser, email client and image editor supports it. It does not support transparency.
- PNG is lossless and supports transparency. It shines on logos, icons, diagrams, and screenshots with large flat areas and sharp text, but it is a poor choice for photographs, which usually end up much heavier than as JPEG.
- WebP supports both lossy and lossless compression as well as transparency. For photos, it generally produces smaller files than JPEG at a similar visual quality, and it is supported by all current major browsers. It is a sensible default for website images, while JPEG remains useful when a file must open in older software.
Resize to the display size before compressing
This is the step that often saves the most, and the one most often skipped. A recent phone takes photos several thousand pixels wide. If your blog layout shows images in a column about 800 pixels wide, the browser downloads every extra pixel and then throws it away when it scales the image down. No quality setting can compensate for an image that is several times larger than it is displayed.
Find the largest width at which the image actually appears in your layout, for example by inspecting it in your browser's developer tools. To keep images crisp on high-density screens such as recent phones and laptops, many sites export at about twice the displayed width; going beyond that rarely brings a visible benefit. If you build pages yourself, the srcset attribute lets the browser choose between several sizes depending on the screen.
Resize first, then compress. Downscaling also reduces visible artefacts, so a resized image often tolerates a slightly lower quality setting.
Lossy or lossless, and which quality setting
Lossless compression, as in PNG, rewrites the data more efficiently but keeps every pixel identical. Lossy compression, as in JPEG and lossy WebP, discards details the eye is unlikely to notice: fine texture, subtle color variations in busy areas. The quality setting controls how far the encoder goes.
There is no universal best value, because the result depends on the image and on the encoder. Still, some starting points work well for photos. For JPEG, a quality between about 70 and 85 usually looks very close to the original while being much lighter than the maximum setting. For WebP, a similar range, often slightly lower, gives comparable results. Above roughly 90, files grow quickly for gains that are hard to see; below about 60, artefacts start to appear.
Always judge with your eyes, zoomed to 100%. Look at the areas that reveal compression first: skies and other smooth gradients, which can show banding; edges around text and objects, which can show halos; and faces and skin. If those look fine, try a slightly lower value; if they do not, go back up. Avoid saving the same JPEG repeatedly, since each lossy pass adds degradation: always start from the best original you have.
Remove the metadata you do not need
Photos from phones and cameras carry EXIF metadata: date and time, camera model, lens settings and often the exact GPS coordinates where the picture was taken. On a website, this information adds bytes without helping the visitor, and the location data in particular can reveal more than you intended, such as where you live.
Many tools strip metadata when they re-encode an image. Keep in mind two side effects: the orientation flag stored in the metadata must be applied to the pixels so the image does not appear rotated, and embedded color profiles may be converted to sRGB, which is the standard color space for the web. For the vast majority of web images, that is exactly what you want.
Why page weight matters for speed and Core Web Vitals
Every kilobyte has to travel over the network before it can be shown. On a fast office connection a heavy image may go unnoticed, but on a mobile connection in a train or in an area with weak coverage, it is the difference between a page that appears immediately and one that stays blank for a long time.
Google measures part of the loading experience through Core Web Vitals. One of them, Largest Contentful Paint (LCP), records when the largest element visible in the viewport finishes rendering. On many pages that element is an image: a hero banner, a product photo, the cover of an article. Google considers an LCP of 2.5 seconds or less as good. A lighter LCP image downloads faster, so it is one of the most direct levers you have on this metric. Core Web Vitals are one of many signals Google uses, so lighter images will not guarantee a ranking, but they make the page genuinely faster for real visitors.
Compression is only part of the picture. Also give images explicit width and height attributes so the layout does not jump while they load, lazy-load images that are below the fold, and do not lazy-load the main image at the top of the page.
A quick workflow to apply to every image
- Start from the original, highest-quality file.
- Decide the format: WebP or JPEG for photos, PNG or WebP for graphics that need sharp edges or transparency.
- Resize to the largest displayed width, or about twice that for high-density screens.
- Set the quality, starting around 75 to 80 for photos, and compare before and after at full size.
- Make sure metadata is removed, especially location data.
- Check the final size and keep the original if the new file is not actually smaller.