Blog / Tutorial

How to Resize Images for Web Without Losing Quality

Optimize images for web with proper resizing. Learn optimal web dimensions, retina displays, srcset, responsive images, file size targets, and BestPNG workflow.

BBestPNG··5 min read

A single oversized image can add seconds to your page load time. Yet resizing incorrectly can produce blurry, pixelated results that look unprofessional. The key is resizing to the right dimensions with the right technique — so your images load fast and look sharp on every screen.

This guide walks through web-optimized image resizing: what dimensions to target, how to handle retina displays, responsive image techniques, and a practical workflow using BestPNG.

Why Image Dimensions Matter for Web

When a browser loads an image, it downloads the full file before rendering it. A 4000x3000 photo (12 megapixels, typically 3-8 MB) displayed in a 600px-wide container means the browser downloads megabytes of data it doesn't need.

The impact is real:

  • Page load speed — Oversized images are the number one cause of slow websites
  • Core Web Vitals — Google's LCP (Largest Contentful Paint) metric directly measures how fast your largest image loads
  • Mobile data — Mobile users pay with bandwidth and patience for every unnecessary KB
  • Hosting costs — Larger files mean more storage and bandwidth consumption

Optimal Dimensions for Common Web Elements

Here are the recommended image widths for typical web layouts:

ElementCSS Display WidthImage Width (1x)Image Width (2x Retina)
Full-width hero1440px1440px2880px
Content area image720px720px1440px
Blog thumbnail400px400px800px
Sidebar image300px300px600px
Product card350px350px700px
Avatar / profile80px80px160px

Important: These are starting points. Your specific layout determines the exact dimensions. Inspect your design to find the actual rendered width of each image container.

Understanding Retina Displays

Retina (high-DPI) displays pack 2x or 3x the pixels into the same physical space. A 400px CSS container on a 2x retina screen actually renders 800 physical pixels. If you serve a 400px image, each pixel gets stretched to cover 4 physical pixels, resulting in a slightly soft appearance.

The 2x Rule

For retina support, serve images at 2x the CSS display size. This covers the vast majority of high-DPI screens (including iPhones, MacBooks, and most modern Android devices).

Serving 3x images is usually unnecessary — the quality difference between 2x and 3x is imperceptible at normal viewing distances, while file sizes increase significantly.

When to Skip Retina

Not every image needs retina support:

  • Decorative backgrounds where softness is acceptable
  • Thumbnails at very small sizes (under 100px CSS width)
  • Performance-critical pages where every KB matters (e.g., landing pages targeting slow connections)

Responsive Images with srcset

The modern approach is to serve multiple image sizes and let the browser pick the best one:

<img
  src="photo-800.webp"
  srcset="
    photo-400.webp 400w,
    photo-800.webp 800w,
    photo-1200.webp 1200w,
    photo-1600.webp 1600w
  "
  sizes="(max-width: 600px) 100vw, (max-width: 1200px) 50vw, 800px"
  alt="Description"
  width="800"
  height="600"
  loading="lazy"
/>

How It Works

  1. srcset lists available image files and their widths in pixels
  2. sizes tells the browser the CSS display width at each breakpoint
  3. The browser combines this information with the screen's device pixel ratio to select the smallest sufficient image

Generating srcset Variants

For each content image, generate 3-5 width variants. A common set:

  • 400px — Mobile, small containers
  • 800px — Tablet, medium containers
  • 1200px — Desktop content width
  • 1600px — Full-width desktop, retina
  • 2400px — Full-width retina (optional, for hero images only)

Use BestPNG's resize tool to create each variant from the original high-resolution file.

File Size Targets for Web Images

Resizing reduces dimensions, but the file may still be larger than necessary. After resizing, compress to hit these targets:

Image TypeTarget File SizeFormat Recommendation
Hero / banner100-200 KBWebP or JPG at 82-88%
Content image50-100 KBWebP or JPG at 80-85%
Thumbnail10-30 KBWebP or JPG at 75-80%
Icon / logoUnder 10 KBSVG, or 8-bit PNG
Background patternUnder 20 KBWebP or PNG

BestPNG's compress tool lets you fine-tune quality to hit these targets after resizing.

Step-by-Step Web Optimization Workflow

Here's a complete workflow for preparing an image for your website:

Step 1: Determine Display Dimensions

Check your CSS or design file to find the maximum display width for the image. Add the intended breakpoint sizes if using responsive images.

Step 2: Resize from Original

Open BestPNG's resize tool and resize your original high-resolution file to the target width. For responsive images, create each srcset variant.

Step 3: Compress

Run each resized image through BestPNG's compress tool. Start at quality 85% for photos, adjust down if the file is still too large.

Step 4: Choose Format

  • Photos: WebP with JPG fallback
  • Graphics with transparency: WebP or PNG
  • Icons and logos: SVG when possible

Step 5: Implement with Proper HTML

Add width, height, alt, loading, and srcset/sizes attributes. Always specify dimensions to prevent layout shift (CLS).

Common Mistakes

Serving the original camera file. A 4000x3000 photo from a DSLR has no business on a web page. Always resize to your display dimensions.

Resizing in CSS only. Setting width: 400px in CSS doesn't reduce the file size. The browser still downloads the full-size image. Resize the actual file.

Ignoring aspect ratio. Stretching an image to fit a container distorts the subject. Use object-fit: cover in CSS for cropping, or resize with BestPNG's aspect ratio lock.

Not specifying width and height. Without explicit dimensions, the browser can't reserve space for the image, causing layout shift (poor CLS score).

Over-sharpening after resize. Some tools apply sharpening automatically. Excessive sharpening introduces halos around edges. BestPNG uses appropriate sharpening by default.

Frequently Asked Questions

What is the maximum image width I should use for web? For most websites, 2400px is a reasonable maximum (covers full-width hero on retina). Going beyond this adds file size without visible quality benefit for virtually all screens.

Should I use WebP or JPG for web images? WebP produces 25-30% smaller files than JPG at equivalent quality and is supported by 97%+ of browsers. Use WebP as your primary format with JPG as a fallback for the remaining edge cases.

How do I handle images in a CMS? Most modern CMS platforms (WordPress, Shopify, etc.) generate multiple sizes automatically on upload. If yours doesn't, resize and compress before uploading. BestPNG works well as a pre-upload optimization step.

Will resizing affect my image's SEO? Properly resized images improve SEO by speeding up page load times (a ranking factor). Always include descriptive alt text and use meaningful filenames for additional SEO value.

What about lazy loading and image resizing? Lazy loading (loading="lazy") controls when images load, not their size. Use both: resize for smaller file sizes, and lazy-load to defer offscreen images. Do not lazy-load your LCP image.

Conclusion

Resizing images for web is about delivering the right pixels to the right screen — nothing more, nothing less. Serve 2x retina dimensions, use responsive srcset for multiple viewports, and compress after resizing.

BestPNG's resize tool handles the dimension changes, and the compress tool optimizes file size — both free and browser-based, with no signup needed.

Resize your images for web with BestPNG →

Selling on Amazon, Shopify or Etsy?

Turn your product photos into studio-grade shots — white-background main images, model try-on, full listing suites. 5 free generations.

Try AI Product Photos →

Continue reading

Product
Best AI Product Photo Generator: 10 Tools Compared 2026
11 min read
Tutorial
Add Watermark to Photos — Protect Your Images Online
6 min read
Tutorial
How to Generate Images from Text: A Beginner's Complete Guide
7 min read