Prepare and compress images for the web

Intermediate  Nov 3, 2026

Make images look sharp and load fast.

Prepare and compress images for the web
The steps of this tutorial at a glance.
The steps of this tutorial at a glance.

Why it matters

Images are often the heaviest part of a page. Smaller files give faster pages and better experience on mobile data.

Prepare and compress images for the web
Prepare and compress images for the web

Steps

1. Resize to the largest size it will be displayed, for example 1600 px wide for a full-width image. Provide a 2x version only where sharpness matters.
2. Choose the format: photos as WebP or JPEG, logos and icons as SVG, simple graphics with transparency as PNG or WebP.
3. Compress: for photos, quality 70 to 85% is usually a good balance. Compare to the original at 100% zoom.
4. Remove metadata that you do not need (camera data, location). This also protects privacy.
5. Name files well: blue-ceramic-vase.webp, for readability and search.
6. Write alt text describing the content.

Tools

Design programs have "Export for web". There are also free tools that compress images in the browser or on your computer.

Targets

For a typical website, aim for under 200 KB for most images, and under 100 KB for small ones. Hero images may be larger, but check that they do not slow the page.

Test

Open the page on a mobile connection, or use browser developer tools to throttle the network, and watch how the images load.

Key ideas to remember.
Key ideas to remember.

More tutorials