Skip to content
ImageZap

Best Image Size for a Website: Pixels and KB

The recommended dimensions and file size for every type of image, how to calculate the exact width you need, and how to shrink a 4 MB photo to under 200 KB without anyone noticing.

By 8 min read

Dimensions and file size: two different things

When people talk about an image's "size" they mix up two concepts worth separating:

  • Dimensions: how many pixels wide and tall it is, for example 1600 × 900 px. They determine how sharp it looks on screen.
  • File size: how many kilobytes the file takes up, for example 140 KB. It determines how long it takes to download.

The two are related (more pixels usually mean more KB), but they aren't the same. A 1600 px photo can weigh 90 KB as AVIF or 900 KB as PNG. That's why you have to control both: first match the dimensions to the size the image is actually displayed at, then pick the format and quality that give the smallest possible file.

Why does it matter so much? Because images are, on average, the heaviest resource on a web page, and the main image is usually the element that decides LCP (Largest Contentful Paint), one of the Core Web Vitals Google uses for ranking. A 4 MB photo straight off a phone can take several seconds to load on a normal 4G connection; the same photo, properly prepared, under half a second.

These are reference values for most websites. They aren't fixed rules: what really counts is the actual width your design displays each image at.

Image typeRecommended dimensionsTarget file size
Full-width hero or header1920–2560 px wide≤ 200–250 KB
Image inside an article or blog post1200–1600 px wide≤ 100–150 KB
Product photo (online store)1000–2000 px, square≤ 150 KB
Thumbnail or card400–800 px wide≤ 30–60 KB
Avatar or profile photo128–256 px, square≤ 10–20 KB
Logo and iconsSVG (vector)≤ 5–15 KB
Social sharing image (Open Graph)1200 × 630 px≤ 300 KB
Decorative background image1920 px wide≤ 150 KB

If your page has several images, think about the total weight too: a good target is for all images visible when the page opens to add up to less than 500 KB, and the whole page to stay under 1.5–2 MB.

How to work out the exact width you need

The rule is simple: width displayed in CSS × the screen's pixel density.

Today's phone and laptop screens have a density of 2x or 3x: they use two or three physical pixels for every CSS pixel. If an image is shown 800 px wide in your design, on a 2x screen it needs 1600 px to look perfectly sharp.

To find the real CSS width, open your site, right-click the image and choose Inspect: the browser's dev tools show the size it's painted at (for example 800 × 450).

A few practical tips:

  • Prepare images for 2x, not 3x. At normal reading distance the eye barely tells 2x from 3x, but a 3x image weighs more than twice as much. It's one of the easiest savings.
  • A phone doesn't need the desktop image. A photo that takes 1200 px on desktop needs about 780 px on a 390 px wide phone. The right way to serve each screen its own version is with srcset and sizes; we explain it in the guide on responsive images with srcset and sizes.
  • Don't go above 2560 px, not even for a hero: beyond that the file grows a lot and the improvement isn't visible.

The weight budget

Thinking in terms of a KB budget per image type helps you decide quickly. If an image goes over budget, reduce its dimensions, switch format or lower the quality.

Hero250 KBContent / blog150 KBProduct150 KBThumbnail60 KBAvatar20 KB
Ballpark values in WebP or AVIF. An original phone photo usually weighs 3 to 5 MB.

The hero has the most room, but it's also the most sensitive: if it's the LCP element, every KB you shave off translates directly into a page that shows up sooner. Google considers an LCP under 2.5 seconds "good"; you'll find every technique to get there in the guide on how to improve LCP for images.

The format matters too

At the same visual quality, the format changes file size a lot:

  • AVIF: the most efficient for photos, 40-50% smaller than JPG. Ideal for the hero.
  • WebP: 25-35% smaller than JPG, fast to encode and accepted by every CMS. The safest option.
  • JPG: universal, but the heaviest of the lossy formats. Use it as a fallback.
  • PNG: only for graphics with transparency, screenshots or flat-color illustrations. Never for photos: a photo as PNG can weigh ten times more than as WebP.
  • SVG: for logos, icons and vector illustrations. Tiny and sharp at any size.

The full comparison is in WebP vs AVIF vs JPEG XL, and when to use lossy or lossless formats is explained in lossy vs lossless compression.

Aspect ratio and layout shifts

Beyond pixels and KB, every image should declare its aspect ratio so the browser reserves the space before downloading it. Otherwise, the text jumps when the image appears, which hurts CLS (Cumulative Layout Shift), another Core Web Vital.

Adding width and height to the tag is enough:

<img src="beach-1600.webp" width="1600" height="900" alt="Beach at sunset">

They don't have to be the displayed dimensions: the browser only uses the ratio (16:9 here) and CSS still controls the final size. If you crop images with CSS, the aspect-ratio property does the same job.

Step by step: preparing an image with ImageZap

  1. Open the image resizer and drag in your photos (you can drop dozens at once).
  2. Pick the maximum width from the table above: for example, 1600 px for article images or 2400 px for a hero.
  3. Choose the output format: WebP to start with, or WebP and AVIF together to compare which is smaller.
  4. Tune the quality: 75 to 82 is the sweet spot for web photos. Compare with the before/after view; if you can't see a difference, go a bit lower.
  5. Check each result's size against the budget and download everything as a ZIP.

Everything happens in your browser: images aren't uploaded to any server. If you only need to reduce file size without changing format, use the JPG compressor; to switch format directly, the JPG to WebP converter.

Sizes for WordPress, Shopify and social media

  • WordPress automatically generates several versions of every image you upload (thumbnail, medium, large…) and serves them with srcset. Since version 5.3 it also scales any larger image down to 2560 px. Even so, upload images already optimized: WordPress doesn't compress as well as a dedicated optimizer. More in the guide on WordPress image optimization.
  • Shopify recommends square product photos at 2048 × 2048 px and also generates the smaller versions. Always upload the same size and ratio so the store grid stays even.
  • Open Graph (the image shown when a link is shared on WhatsApp, LinkedIn, X or Facebook): 1200 × 630 px, as JPG or PNG, with the important text centered because some networks crop it. You'll find every network's sizes in the guide on social media image sizes.

Most common mistakes

  • Uploading the photo straight from the camera or phone. A 4000 px, 4 MB photo displayed at 800 px wastes over 90% of its bytes. And if it's an iPhone HEIC, Chrome won't even display it: convert it to JPG or WebP before uploading.
  • Shrinking with CSS only. Setting width: 400px on a 3000 px image makes it smaller on screen, but the browser still downloads all 3000 px.
  • Using PNG for photographs. It's a lossless format meant for graphics; for photos it multiplies the file size.
  • Preparing everything at 3x "just in case". More than twice the weight for an improvement almost nobody notices.
  • Forgetting the main image. Putting loading="lazy" on the hero delays LCP; that image should load with priority. We explain it in the guide on lazy loading and fetchpriority.

Frequently asked questions

What pixel size should an image for a website be?

It depends on where it's displayed: about 1920–2560 px wide for a full-screen hero, 1200–1600 px for article images and 400–800 px for thumbnails. The general rule is to multiply the width it's shown at in your design by 2 for high-density screens.

What's the maximum KB for a web image?

As a guide, under 200–250 KB for the main image, under 100–150 KB for content images and under 50 KB for thumbnails. With WebP or AVIF at quality 75-82 that's easy to hit.

Should web images be 72 or 300 DPI?

It doesn't matter. DPI (dots per inch) only matters for printing. On a website the browser only looks at pixel dimensions, so a 1600 px image looks the same whether its metadata says 72 or 300 DPI.

What size should a hero image be?

Between 1920 and 2560 px wide, ideally as AVIF or WebP and under 250 KB. If the header doesn't span the full width, measure its real width in your design and multiply it by 2.

What image size does WordPress recommend?

WordPress doesn't require a size, but it automatically scales larger images down to 2560 px. The best practice is to upload them already at the largest size they'll be displayed at (usually 1600–2560 px) and compressed.

Is JPG or WebP better for a website?

WebP: at the same visual quality it's 25-35% smaller and works in every modern browser. JPG only makes sense as a fallback for very old browsers.

How do I reduce an image's file size without losing quality?

First resize it to the dimensions you actually need, then convert it to WebP or AVIF and set quality between 75 and 82. With those three steps, a 4 MB photo usually ends up at 150–250 KB with no visible difference.

Related guides