How to Optimize Images for a Website: Size, Format, Speed
Images are usually the heaviest part of a web page. Here's a practical checklist for sizing, formatting and compressing them so pages load fast.
On most websites, images are the heaviest thing on the page. A single unoptimised hero photo can weigh more than all the text, code and fonts combined. That slows your pages down, which frustrates visitors on phones, hurts conversions and can count against you in search, where page experience matters.
The good news: image optimisation is mostly a checklist. This guide walks through it in order: the right dimensions, the right format, the right compression, and the technical touches (lazy loading, responsive images and alt text) that make images fast and accessible.
Step 1: Resize images to the size they're shown
This is the biggest win and the one most often skipped. A photo straight from a phone is about 4000 pixels wide; most website content areas are 700–1200 pixels wide. Uploading the full photo makes every visitor download three or four times more pixels than they can see.
Guidelines:
- Full-width hero images: 1600–2400 pixels wide.
- Images inside articles: 1200–1600 pixels wide (about twice the display width, for sharp phone and retina screens).
- Thumbnails and product grids: 400–800 pixels wide.
- Logos and icons: use SVG where possible.
Use the resize tool with the aspect ratio locked, or the batch editor for up to 100 images at once.
Step 2: Choose the right format
- WebP: the best default for photos and graphics on the web. Typically 25–35% smaller than JPG at the same quality, supports transparency, and works in every modern browser. Convert with the JPG to WebP or PNG to WebP converters.
- AVIF: even smaller than WebP for many photos, with growing browser support. Great if your platform can serve it with a fallback.
- JPG: universally supported, good for photos. Use it where WebP isn't accepted.
- PNG: for screenshots and graphics that must be pixel-perfect, or when you need transparency and can't use WebP. Too heavy for photos.
- SVG: for logos, icons and simple illustrations. Tiny, and sharp at any size.
Many website platforms convert uploads to WebP automatically; check yours before converting by hand.
Step 3: Compress to a sensible target
After resizing and choosing a format, compress. Targets that work for most sites:
- Hero images: under 200–300 KB.
- Article images: under 100–150 KB.
- Thumbnails: under 30–50 KB.
The image compressor lets you type a Target size and finds the best quality that fits. For WebP, a high quality setting is usually already small enough.
Always look at the result at full size. If you see blocky skies or fuzzy text, raise the target a little.
Step 4: Use responsive images
Phones don't need the same image as a 27-inch monitor. Responsive images let the browser choose:
- srcset and sizes in HTML give the browser several widths of the same image (for example 600, 1200 and 1800 pixels) and it downloads the smallest one that looks sharp on that screen.
- The picture element can serve AVIF or WebP to browsers that support them and JPG to the rest.
Most modern platforms (WordPress, Shopify, Squarespace, Next.js and others) generate these automatically when you upload a large enough original. If you build sites by hand, it's worth setting up.
Step 5: Lazy-load images below the fold
Images that aren't visible when the page first loads don't need to download straight away. Adding loading="lazy" to an image tag tells the browser to wait until the visitor scrolls near it. It's supported by all modern browsers and saves a lot of data on long pages.
Don't lazy-load the main image at the top of the page, the one visitors see first. That image should load as early as possible, because it's often what speed tools measure as your Largest Contentful Paint.
Step 6: Set width and height
Always give images a width and height (or an aspect ratio in CSS). The browser can then reserve the right space before the image arrives, so text doesn't jump around as images load. That jumping is measured as layout shift, and it's both annoying and bad for page experience scores.
Step 7: Write useful alt text
Alt text describes an image for people using screen readers, and for search engines. Good alt text is short and specific: "Red leather handbag on a marble table" rather than "image1" or a list of keywords. Decorative images that add nothing (background textures, dividers) can have empty alt text so screen readers skip them.
Give files sensible names too: red-leather-handbag.webp tells search engines more than IMG_4821.jpg.
Step 8: Test your pages
Free tools show how much your images cost you:
- PageSpeed Insights (from Google) highlights oversized images, missing dimensions and images that could use modern formats.
- Your browser's developer tools (Network tab) show every image's size as it loads.
Fix the biggest offenders first. Usually a handful of huge images account for most of the weight.
A quick optimisation checklist
- Resize to about twice the display width, never more.
- Use WebP (or AVIF) for photos and graphics; SVG for logos.
- Compress: heroes under 300 KB, article images under 150 KB.
- Serve responsive sizes with srcset.
- Lazy-load everything except the top image.
- Set width and height on every image.
- Write short, specific alt text and descriptive file names.
- Re-test after changes.
Platform tips: WordPress, Shopify and website builders
WordPress creates several sizes of every image you upload and serves them responsively. Upload images around 2000 pixels wide rather than full phone photos, and consider an optimisation plugin that converts to WebP.
Shopify resizes product images and serves modern formats automatically. Upload square or consistent-ratio product photos around 2048 pixels for zoom, compressed to under about 500 KB.
Squarespace, Wix and similar builders also resize for you. Their main weakness is huge originals, which they still store and sometimes serve in galleries, so resize and compress before uploading.
Hand-built sites benefit most from doing it yourself: WebP or AVIF files, srcset widths and explicit dimensions.
Image SEO beyond speed
Fast images help, but a few more habits help your images appear in image search and help search engines understand your pages:
- Use real, original photos where you can. Stock photos used on thousands of sites add little.
- Place images near the text they illustrate, with a caption where it helps.
- Use descriptive file names before uploading: "blue-ceramic-mug.webp", not "DSC_0042.jpg".
- Write alt text for people, not for keyword counts.
- Include important images in the HTML, rather than only as CSS backgrounds, so they can be found.
How much faster will my site be?
It depends on how heavy your images are now. A page with five 3 MB phone photos weighs 15 MB; resized to 1600 pixels and saved as WebP, the same five images might weigh 1 MB in total. On a typical mobile connection, that's the difference between waiting several seconds and the page appearing almost at once.
The gains are biggest on image-heavy pages: galleries, product listings, portfolios and blog posts with lots of screenshots. Start with your most visited pages, measure them before and after, and you'll quickly see where the effort pays off.
Frequently asked questions
What is the best image format for websites?WebP for most photos and graphics, AVIF where supported, SVG for logos and icons, and JPG as a fallback.
What size should website images be?About twice their display width: 1200–1600 pixels for article images, 1600–2400 for full-width heroes.
How small should website images be in KB?Roughly under 300 KB for heroes, 150 KB for article images and 50 KB for thumbnails.
Does image size affect SEO?Indirectly. Heavy images slow pages down, and page speed is part of the experience search engines consider.
Should I lazy-load all images?All except the main image at the top of the page, which should load as early as possible.
Can I optimise many images at once?Yes. The batch editor resizes, compresses and converts up to 100 images in your browser.
Should I use PNG or JPG for website photos?Neither, ideally: WebP is smaller than both. If you must choose, JPG for photos and PNG for graphics with sharp text or transparency.
Do CDNs optimise images automatically?Many image CDNs resize and convert images on the fly, which helps a lot. Uploading sensibly sized originals still saves storage and processing.
How do I find which images are slowing my site?Run the page through PageSpeed Insights, or open your browser's developer tools and sort the Network tab by size.
Do I need to optimise images on a website builder?Builders help, but uploading sensibly sized images still makes pages faster.
Key takeaways
Optimising images is a checklist: resize to the display size, choose WebP or AVIF, compress to a sensible target, serve responsive sizes, lazy-load below the fold, set width and height, and write good alt text. Start with your heaviest images and test again; small changes often cut page weight in half.




