How to shrink photos for the web without losing useful quality
Updated 2026-10-21. “Make this image smaller” can mean three different jobs: crop the composition, resize the pixel dimensions, or compress the encoded file. Doing them in the wrong order can leave an image blurry, heavy, or badly framed. This guide gives a repeatable workflow using our image cropper and resizer and image compressor. The tools process images in the browser; they do not replace a design review of the final result.
Crop, resize, and compress are different
Cropping removes pixels outside a selected rectangle. It changes composition and can change the aspect ratio. Resizing maps the chosen pixels to a new width and height. It changes dimensions, not the subject's framing. Compression encodes those pixels into a file, trading size against fidelity depending on format and settings. A 4,000 by 3,000 image may need a square crop, a 1,200-pixel resize, and then a quality setting; none of those operations is the same as the others.
Start with the destination
Choose the space where the image will appear before editing. A profile avatar, a blog hero and a product thumbnail need different shapes. If the destination is 1,200 × 800, its aspect ratio is 1.5, or 3:2. A source already at 2,400 × 1,600 has that ratio and can be resized without cropping. A 4,000 × 3,000 source is 4:3, so a 3:2 output requires removing some height or accepting a different result.
Three worked dimension examples
- Square. For a 4,000 × 3,000 photo, a centred square crop uses a 3,000 × 3,000 region. Resize that region to 1,200 × 1,200. The crop removes 500 pixels from each side horizontally if centred; move the crop when the subject is not central.
- Matching landscape. A 2,400 × 1,600 image is already 3:2. Resize it to 1,200 × 800. No crop is needed, and each output dimension is half the source dimension.
- Portrait. A 3,000 × 4,000 image for a 900 × 1,200 slot is also 3:4. Resize it to 900 × 1,200 after checking the subject and leaving enough space for the crop. Do not stretch a 3:2 source into 3:4; crop it instead.
Use the cropper when the framing or exact dimensions matter. Check the output dimensions before compressing. If a destination will display the image at 600 pixels wide, a 6,000-pixel source is usually unnecessary unless you need a high-density version.
Pixels, aspect ratios, and perceived quality
Pixel dimensions set the detail ceiling. A larger source cannot restore detail that was never captured, and enlarging a small image usually makes edges softer. Perceived quality also depends on viewing distance, contrast, sharpening, the subject and the browser's scaling. Compare the exported image at its intended display size, not only at 400% zoom.
Keep the aspect ratio when resizing unless you intentionally crop. The basic ratio is width divided by height. If the source is 1,600 × 1,000, its ratio is 1.6. A 1,200-pixel-wide proportional resize is 1,200 × 750. Entering 1,200 × 800 instead changes the ratio and distorts the image if the pixels are stretched rather than cropped.
Choosing JPEG, PNG, and WebP
JPEG is useful for photographs because it usually produces a small file with lossy compression. Lower quality can introduce blockiness, ringing around text, and colour changes. PNG is useful when lossless pixels or transparency matter, but a photographic PNG can be much larger. WebP supports lossy and lossless modes and is supported by current browsers; Google's WebP documentation explains the format and trade-offs. Select a format based on the image and the consumers, not on a promise that one format always wins.
Compression quality is not a universal percentage. A quality value is interpreted by the encoder and can produce different sizes for different images. After exporting, compare the file size and inspect faces, fine text, gradients, edges and transparent areas. Keep the original until the output has passed that check.
What browser-side processing means
The cropper uses the browser's canvas pipeline to select and export pixels, while the compressor re-encodes files locally. MDN's Canvas toBlob documentation describes how a canvas can create a file in a chosen format and quality. Local processing is useful for private drafts and large originals because the file need not be uploaded to a conversion service. It is not a guarantee about every other site or every browser extension: check the page's stated behaviour and your own network policy.
Transparency, metadata, and oversized files
PNG and some WebP workflows can preserve transparency; JPEG cannot, so transparent pixels need a background before conversion. Do not assume EXIF metadata, orientation, GPS data, colour profiles or filenames will survive a browser export. If metadata matters, verify the downloaded file with a suitable inspection tool. If privacy matters, consider removing location metadata before sharing. Very large files can be slow or memory-intensive in a browser; work from a copy and close other heavy tabs if the device struggles.
A repeatable export checklist
- Write down the destination width, height and aspect ratio.
- Crop to the intended framing before changing dimensions.
- Resize proportionally unless the crop defines the new ratio.
- Choose JPEG, PNG or WebP for the actual image content.
- Export, compare visual quality at display size, and check file bytes.
- Open the downloaded file in the target browser and keep the original.
Optimising a page without over-compressing it
Start with the largest practical win: remove pixels that will never be displayed. A camera original might be 8,000 pixels wide while a content column is 900 pixels. Resize a copy to the required maximum, then compare the result. If a site supports responsive images, create a small set of widths rather than forcing every visitor to download the largest file. Preserve the original as an archive, not as the public asset.
Next, test the format. Export one JPEG and one WebP at comparable visual quality, then inspect a crop containing hair, leaves, text and a smooth sky. A smaller byte count is not a win if the important detail is damaged. For a logo, screenshot or diagram with sharp edges, PNG or lossless WebP may be more appropriate. For a photograph, lossy JPEG or WebP often gives a better size-quality balance. There is no single quality number that transfers between encoders.
Common failure modes
A stretched image has been given new dimensions without preserving its ratio. A blurry image was enlarged from too few source pixels or compressed repeatedly. A missing subject is a crop problem: the ratio was chosen without checking the focal point. A huge “compressed” image may still be a large pixel dimension, contain unnecessary metadata, or have been exported losslessly when a photo could tolerate controlled loss. Diagnose the stage that caused the problem instead of applying more compression blindly.
Repeated JPEG exports can accumulate visible artefacts. Keep a high-quality original and perform the crop, resize and final encode from that original. For transparent graphics, check the background after conversion because JPEG replaces transparency. For photographs containing location data, inspect metadata before publishing and remove it when it is not needed.
Accessibility and delivery considerations
Technical optimisation is not the whole user experience. Give an image useful alternative text, use the correct focal crop, and avoid making text inside an image the only way to understand a page. Reserve the intrinsic width and height where possible so the layout does not jump while the image loads. A small file can still be the wrong file if it is unreadable, misleadingly cropped, or delivered at a size that forces interpolation.
Quality is contextual
A web image is successful when it is clear enough at the size a visitor sees and small enough to load without unnecessary delay. A 40 KB icon and a 400 KB hero photograph have different jobs, so comparing them with the same target is unhelpful. Measure the exported bytes, but also inspect the page on a normal screen and a phone. If important writing is embedded in the image, make sure it remains legible; do not solve a content problem by making the file enormous.
Keep a simple record for repeatable work: original dimensions and format, crop rectangle, output dimensions, output format, quality setting, file size and visual check. That record lets you reproduce a good result and explain why an image changed. It also helps a team distinguish a deliberate new crop from accidental recompression.
For a final check, compare the exported image at 100% and at its real display size. If the subject is clear and the bytes are materially smaller, the optimisation has done its job.
Sources and related tools
References: MDN Canvas toBlob and Google WebP. Crop and size with the image cropper, then reduce file size with the image compressor. The tool directory has both tools and their related guides.