By the ImageOpti team ·
Image Optimization for Websites: A Practical Guide
Learn how to optimize images for a faster website: the right format, size and compression, with free browser-based tools to do it.
Images are usually the heaviest thing on a web page. A single unedited photo from a phone can weigh more than all of a page's scripts and styles put together, and every extra kilobyte is time a visitor spends waiting. This guide is for site owners, bloggers, shop managers and developers who want pages that load quickly without pictures that look worse for it.
Image optimization comes down to four levers: dimensions (how many pixels), format (how they are stored), compression (how much detail is traded for size) and delivery (how the browser loads them). Pull them in that order, because each one makes the next more effective. Everything below can be done with free tools that run in your browser, so your files are never uploaded to a server.
Start here: the tools for each lever
- The image optimizer compresses JPEG, PNG and WebP files and shows the size before and after.
- Resize images before compressing so you are not compressing pixels nobody will ever see.
- Convert image to WebP when you want a modern format with broad browser support.
- Need to hit a specific limit? There are focused pages to compress a JPEG to 100 KB and to compress an image to 50 KB.
Why image weight matters
A heavy image costs you in three places. Visitors on slower mobile connections wait longer, and some give up before the page finishes. Search engines treat speed as part of the page experience, and the largest image on screen is often the element that decides your Largest Contentful Paint score. Finally, bandwidth and storage costs add up on image-heavy sites such as stores and portfolios.
The good news is that images are also where the easiest wins are. Most oversized images are oversized by accident: exported at camera resolution, saved in a heavy format, or never compressed. Our post on how to compress images for a faster website walks through the full case, and image optimization for Core Web Vitals explains how the metrics react.
Step 1: Right-size the dimensions
The most common mistake is serving a 4000-pixel-wide photo into a 800-pixel-wide column. The browser downloads every pixel and then throws most of them away when it draws the page. Before touching quality settings, decide the largest size the image is ever displayed at and resize to that.
A practical method: open the page on a desktop screen, inspect the image and note its rendered width. Then allow for sharper displays by exporting at up to twice that width if the image is important, such as a hero banner, and at the displayed width for decorative or small images. Resize images before compressing and keep the aspect ratio locked so nothing is stretched.
Shrinking is safe. Pixels are removed, not invented, so a correctly scaled-down image looks clean. Enlarging is the opposite, which is covered in the image resizing and quality guide.
Step 2: Pick the right format
Format decides how efficiently the same picture can be stored.
| Content | Good default | Why |
|---|---|---|
| Photographs | WebP or JPEG | Smooth gradients compress well with lossy formats |
| Screenshots, logos, text | PNG or WebP | Sharp edges stay crisp |
| Images needing transparency | PNG or WebP | JPEG has no transparency |
| Simple animations | WebP or GIF | WebP is usually smaller where supported |
WebP is a strong default for most site images because it handles photos and graphics, and current browsers support it. JPEG remains the safest fallback. AVIF can be smaller still, with trade-offs covered in AVIF vs WebP vs JPEG, and the image conversion guide covers every format in detail. To switch an existing image, convert image to WebP and compare the file sizes.
Step 3: Compress
Compression is where most of the size comes out, and also where quality can quietly slip, so it helps to understand the two kinds. Lossy compression discards detail the eye is least likely to notice; lossless compression rearranges the data without discarding any. Our explainer on lossy vs lossless compression covers the difference, and the guide to reducing image file size without losing quality shows how to find a setting that looks right.
Some working rules:
- Start moderate and look at the result. Zoom to 100 percent on detailed areas such as hair, text and edges. If you cannot see a difference, the setting is fine; if you can, back off.
- Treat photos and graphics differently. Photos tolerate stronger lossy settings than screenshots with small text.
- Keep your original. Compress a copy so you can re-export later from the full-quality source.
- Do not compress twice. Repeatedly saving a lossy file compounds the damage. Compress once, from the original.
For graphics saved as PNG, compress PNG files in the browser and check that sharp edges stay clean. When a form or platform sets a size limit, use the targeted pages to compress a JPEG to 100 KB or compress an image to 50 KB. The same logic applies to attachments, which is the subject of how to compress images for email.
There is no universal number for "small enough". As a rough aim, many in-content images can sit well under a few hundred kilobytes and hero images a little above that, but the right budget depends on the image and your audience.
Step 4: Serve images efficiently
Smaller files help, but how the page asks for them matters too.
- Set width and height. Declaring the dimensions lets the browser reserve space before the image arrives, which prevents the page from jumping as it loads (layout shift).
- Lazy-load below the fold. Add
loading="lazy"to images that are not visible on first paint, so they download only when the visitor scrolls near them. - Never lazy-load the main image. The large image at the top of the page should load immediately.
- Offer sizes. The
srcsetandsizesattributes let a phone fetch a smaller file than a desktop does. - Write useful alt text and filenames.
blue-ceramic-teapot.webphelps accessibility and image search far more thanIMG_4821.webp.
Developers who want to automate these steps should read the image workflow for developers.
A checklist to run on any page
- Is every image no wider than it needs to be?
- Is each one in an appropriate format, with WebP or JPEG for photos?
- Have you compressed from the original and compared the result at full zoom?
- Do all images have width and height, and descriptive alt text?
- Are below-the-fold images lazy-loaded and the top image not?
- Is a size budget written down so new uploads follow it?
Frequently asked questions
How big should website images be?
There is no single number. Match the image to the largest size it is displayed at, then compress it. As a rough aim, many content images can be well under a few hundred kilobytes, and hero images a little more.
Which image format is best for a website?
WebP is a strong default for photos and graphics, JPEG remains widely compatible, PNG suits graphics needing exact detail, and AVIF can be smaller still where supported. See the conversion guide for details.
Do images affect SEO?
Indirectly. Heavy images slow the page and can hurt Core Web Vitals, which are part of the page experience signals. Descriptive filenames and alt text also help images appear in image search.
Can I optimize images without uploading them?
Yes. The ImageOpti tools process files in your browser, so nothing is uploaded.
Related guides
Ready to start? Open the image optimizer, drop in your heaviest images and see how much smaller they get.