Skip to main content
All posts
Web Performance·

Optimize Website Images Before You Upload

A practical workflow for web images: resize to the display slot, choose a format, compress from the master, set dimensions, and test the live page.

Optimize Website Images Before You Upload

Updated: November 6, 2026

Quick answer: Resize each image to the largest width your layout shows, export WebP or JPEG at quality 75-85, keep heroes under roughly 200 KB, set width and height on every image, lazy-load below-the-fold images, and test the published URL on a phone.

Most slow landing pages are not slow because of bloated JavaScript frameworks. They stall because somebody dragged a 6 MB raw camera photo straight into a CMS media library for an 800-pixel blog slot.

Fixing that does not require complex automated build pipelines or expensive enterprise image CDNs. The real leverage happens at export time, right before the file leaves your local workstation.

Why images dominate Core Web Vitals and LCP

Images consistently make up nearly half of the total payload on modern websites. When Google measures Largest Contentful Paint (LCP), the target element is almost always a top-of-page hero banner or product photograph.

Three levers determine total file weight:

  1. Pixel dimensions (width and height).
  2. Compression codec (PNG vs WebP vs AVIF).
  3. Quality setting (quantization level).

A 4000×3000 camera shot contains 12 million pixels. Resizing that same picture to 1600×1200 leaves 1.92 million pixels — shedding 84% of the raw data before any compression even touches it. If you skip resizing and only drag a quality slider, you are trying to squeeze twelve million pixels through a cellular straw.

To pass Core Web Vitals on standard 4G connections (1.6 Mbps throughput), web pages should allocate explicit byte budgets per component slot.

Page SlotLayout Display SlotRecommended Export SizeTarget FormatMax Byte BudgetImpact on LCP
E-commerce Hero Banner1200-1440px wide1920×1080px (2x Retina)WebP or AVIF120 - 180 KBDirect LCP element; keep < 1.8s
Product Catalog Gallery300-400px cards800×800px squareWebP40 - 75 KBCritical for smooth catalog scrolling
SaaS Landing Screenshot800-1000px column1600×1000px (Lossless)WebP (Lossless) / PNG150 - 250 KBPrevents text fuzziness in UI callouts
Editorial Inline Photo680-800px article body1400×933px landscapeWebP (Quality 78)70 - 110 KBLazy-load below fold; no LCP impact
Logo & Brand Marks150-240px wideScalable vectorSVG5 - 25 KBInstant render; zero layout shift

Format migration: real-world bandwidth comparison

Switching legacy formats (JPEG and PNG) to modern WebP or AVIF yields predictable bandwidth savings without noticeable degradation at normal viewing distances.

Test Asset DescriptionDimensionsLegacy Format (Size)Modern WebP (Quality 80)Savings (%)Visual Fidelity at 100% Zoom
Outdoor Hero Photo1920×1080JPEG: 1,240 KBWebP: 182 KB85.3% reductionIndistinguishable from source JPEG
Software Dashboard UI1600×90024-bit PNG: 2,150 KBLossless WebP: 340 KB84.2% reductionRazor-sharp text, perfect UI borders
Apparel Product Shot1200×1200JPEG: 680 KBWebP: 115 KB83.1% reductionClean fabric textures, no color banding
Marketing Badge (Alpha)600×60032-bit PNG: 480 KBWebP with Alpha: 82 KB82.9% reductionClean transparency edges without halos

Five-step image optimization workflow

  1. Resize to the target container. Determine the maximum physical width your layout requires on desktop screens, then multiply by 1.5x or 2x for high-DPI displays. Never upload 4000px masters for an 800px column.
  2. Select the right format for the content. Photos belong in WebP or JPEG. UI captures with fine text belong in lossless WebP or indexed PNG. Logos and icons should remain SVG.
  3. Compress using local browser tools. Process your files locally with LessMB Image Compressor. Because processing runs in your browser sandbox, your unpublished product photos and client materials are never uploaded to a third-party server.
  4. Set explicit width and height attributes in HTML. Always define width and height attributes on <img> tags. This reserves aspect-ratio space in the browser layout before bytes download, preventing layout shifts (CLS).
  5. Add native lazy-loading for below-the-fold media. Apply loading="lazy" to secondary cards and footer media. Crucially, never apply lazy loading to your hero image, as doing so delays your LCP metric.

If you are preparing MP4 hero loops or product clips alongside website graphics, run them locally through our video compressor, follow our CRF bitrate guide on how to compress MP4 video online without losing quality or how to compress video to 8MB, 10MB, or 25MB, and bundle deployment assets with the file compressor.

FAQ

What size should web images be?

Match the slot, not the camera. Most blog columns render at 680-800px, so a 1600px export covers sharp screens. Full-width heroes rarely need more than 1600-1920px.

Is quality 75 too low for photos?

Usually no. At display size, quality 75-85 looks identical for most photos. Inspect faces, text, and gradients at 100% zoom and raise quality only where you can see the difference.

Do I still need JPEG?

Mostly as a fallback. WebP works in every current browser and saves 25-35% at similar quality. Keep JPEG for platforms and email clients that reject WebP.

How much smaller will my page get?

Resize first. A 4000px photo resized to 800px loses about 96% of its pixels. Format and quality settings then cut the remainder by another 30-50%.

Try it now — 100% in your browser

No upload, no sign-up, no watermark. Your files never leave your device.

Open Image Compressor