Ideal Image Size for Website Speed (Core Web Vitals)
The ideal image size for a fast website: match pixels to display size, pick WebP or AVIF, set width and height, and keep your LCP image quick.

There is no single ideal image size for website speed, but there is a reliable rule: an image's pixel width should match the largest width it is actually displayed at, multiplied by the screen's pixel density (usually capped at 2x), saved in a modern format like WebP or AVIF and compressed to the lowest quality that still looks right. Get those three things right, add width and height to the tag, and images stop hurting your Core Web Vitals. This guide shows how to work out the numbers for your own pages, and how to fix oversized images for free with our image resizer and image compressor.
Why image size matters for Core Web Vitals#
Core Web Vitals are the three page experience metrics Google measures on real visits. Two of them are directly affected by images:
- Largest Contentful Paint (LCP) measures how long the biggest visible element takes to render. On many pages that element is an image: a hero banner, a product photo, a featured article image. Google's LCP guide on web.dev sets "good" at 2.5 seconds or less, measured at the 75th percentile of page loads. A 3 MB hero photo on a phone connection can blow through that on its own.
- Cumulative Layout Shift (CLS) measures how much the page jumps around while it loads. An image without declared dimensions takes up no space until it arrives, then shoves everything below it down the page. A good CLS score is 0.1 or less.
The third metric, Interaction to Next Paint (INP), is about responsiveness to clicks and taps, and images rarely move it much. So for images, the job is: make the LCP image arrive fast, and make every image reserve its space.
Two different "sizes": dimensions and file weight#
When people ask about image size, they usually mean one of two things, and you need both under control:
- Pixel dimensions, like 1600 × 900. This decides how sharp the image can look and sets a floor on how big the file is.
- File size, like 180 KB. This is what actually travels over the network and what LCP is waiting for.
A photo straight off a modern phone is often 4000 pixels wide or more. If your blog column displays it at 720 pixels, the browser downloads every one of those extra pixels and then throws them away when it scales the image down. Resizing first is usually the single biggest saving available, before you even touch compression.
How to work out the right pixel dimensions#
Use this formula for each image slot on your page:
pixel width = displayed width in CSS pixels × device pixel ratio
The device pixel ratio is how many physical pixels a screen uses per CSS pixel. A typical desktop monitor is 1x, most laptops with high-density screens and most phones are 2x, and many recent phones are 3x. Here is the arithmetic for some common layouts:
| Where the image appears | Displayed width (CSS px) | 1x file | 2x file |
|---|---|---|---|
| Small card thumbnail | 360 | 360 px | 720 px |
| Blog or article column | 720 | 720 px | 1440 px |
| Full-width hero on a 1280 px wide layout | 1280 | 1280 px | 2560 px |
| Full-width image on a 390 px wide phone | 390 | 390 px | 780 px |
Many sites stop at 2x even for 3x phones. The file gets much bigger at 3x (it has more than twice the pixels of a 2x version), while the visible difference at normal viewing distance is small. That trade-off is a judgment call, but 2x is a sensible default.
To find the displayed width of an existing image, open your page, right-click the image, choose Inspect, and hover over the <img> element in the developer tools. The browser shows both its rendered size and its intrinsic (actual file) size. If the intrinsic width is several times larger than the rendered width, that image is a resizing candidate.
How small should the file be?#
There is no official file size limit, and any precise "every image must be under X KB" rule is a rule of thumb rather than a standard. What you can control is the format and the quality setting:
- Use WebP or AVIF instead of JPG and PNG. According to Google's WebP documentation, lossless WebP images are 26% smaller than PNGs, and lossy WebP images are 25 to 34% smaller than comparable JPEGs at the same quality index. AVIF often compresses further still, at the cost of slower encoding. Both are supported by every major current browser. Our explainer on what a WebP file is covers the format in more depth.
- Pick a quality setting by eye, not by habit. For photos, a quality setting in the 75 to 85 range is a reasonable starting point. Compare the result with the original at the size it will actually be displayed, then go lower until you can see a difference and step back up once.
- Keep PNG for what it's good at. Screenshots with sharp text, logos and flat graphics can stay lossless, but converting them to lossless WebP usually still saves space.
If you want the full background on what quality settings actually throw away, read our guide on how to compress images without losing quality.
Let the browser pick the right size with srcset#
One file can't be the right size for both a phone and a 27-inch monitor. The srcset and sizes attributes let you offer several widths and let the browser choose:
<img
src="hero-1280.webp"
srcset="hero-640.webp 640w, hero-1280.webp 1280w, hero-2560.webp 2560w"
sizes="100vw"
width="1280"
height="720"
alt="Describe the image here"
fetchpriority="high"
>
The browser combines the sizes hint with the screen's pixel density and downloads only the file it needs. MDN's guide to responsive images explains the syntax in detail, including how to write sizes for images that don't span the full viewport.
Two attributes in that example matter specifically for Core Web Vitals:
widthandheightlet the browser reserve the right amount of space before the file arrives, which prevents layout shift. They describe the aspect ratio; your CSS can still make the image responsive withmax-width: 100%andheight: auto.fetchpriority="high"tells the browser this image is important and should be requested early. Use it on your LCP image only.
Equally important is what not to do: don't add loading="lazy" to the image that is your LCP element. Lazy loading is great for images further down the page, but on the hero image it delays exactly the download that LCP is waiting for.
Step 1: Find your largest and heaviest images#
Run your page through PageSpeed Insights or the Lighthouse panel in Chrome's developer tools. Look at which element is reported as the LCP element, and check the image-related suggestions, which flag images that are larger than their displayed size or could use a more efficient format.
Step 2: Resize each image to its display size#
Work out the target width with the formula above, then resize the original with our Resize Image tool. Enter the width in pixels with the aspect ratio locked, and the height follows automatically. If you're using srcset, export one copy for each width you plan to offer.
Step 3: Convert and compress#
Turn PNGs into WebP with PNG to WebP, and photos with JPG to WebP or JPG to AVIF. Or use the Compress Image tool, which can re-encode to WebP, AVIF, JPG or PNG with a quality slider and process a whole batch at once. Every one of these runs in your browser, so your images are never uploaded to a server.
Step 4: Update the HTML and test again#
Swap the new files into your page, add width, height and (where useful) srcset and sizes, then run the same test again. Field data in Search Console's Core Web Vitals report updates more slowly, because it's based on real visits collected over the previous 28 days, so expect lab tools to show the improvement first.
Web images aren't print images#
If you've ever been told to save images at "72 DPI for the web", you can safely ignore it. Browsers ignore the DPI value stored in an image file completely; only the pixel dimensions matter on screen. DPI only becomes meaningful when you print, which is a different calculation covered in our guide to image size and DPI for printing. For more guides like this one, browse our technology articles or the full set of image tools.
Frequently asked questions#
What is the ideal image size for a website? The ideal image size is the largest width the image is displayed at in CSS pixels, multiplied by the device pixel ratio, usually up to 2x. For example, an image shown in a 720 pixel wide article column should be about 1440 pixels wide, saved as WebP or AVIF.
What size should a hero image be for website speed?
A full-width hero image should be no wider than the largest layout width it appears in, times 2 for high-density screens, and served with srcset so phones get a smaller version. On a layout that tops out at 1280 CSS pixels, that means a largest file of around 2560 pixels, with smaller versions for smaller screens.
Do large images hurt Core Web Vitals?
Yes, oversized images mainly hurt Largest Contentful Paint, because the browser has to download the whole file before it can show the largest element on the page. Images without width and height attributes also hurt Cumulative Layout Shift, because the page jumps when they finish loading.
Is WebP or AVIF better for page speed? Both are much better than JPG and PNG for page speed, and AVIF usually produces the smaller file of the two. WebP encodes faster and has been supported in browsers for longer, so it's the easier default, while AVIF is worth testing for large photographic images.
Should I lazy load all images? No, you should lazy load images below the fold but never the image that is your Largest Contentful Paint element. Lazy loading the LCP image delays its download and makes your LCP score worse.
Does image DPI affect website speed? No, the DPI value saved in an image file has no effect on how a browser displays it or how fast it loads. Only the pixel dimensions and the file size matter for the web.
The short version#
- Size each image to its displayed width × pixel density, capped at 2x for most sites.
- Serve WebP or AVIF, compressed to the lowest quality that still looks right at display size.
- Always set
widthandheight, usesrcsetfor images that change size across screens, and give the LCP imagefetchpriority="high"without lazy loading. - Fix oversized images in your browser with Resize Image, PNG to WebP and Compress Image, then re-test.
Try the tools
Free, private, and instant. Everything runs in your browser.



