PixConvertly ▶ How to use
Compression & Speed

How to Optimize Images for Website Speed and Core Web Vitals

By PixConvertly · 6 min read · Updated November 19, 2026

How to Optimize Images for Website Speed and Core Web Vitals - optimize images for website speed guide

If you want to optimize images for website speed, you are working on the part of a page that is often the heaviest. On many sites, images make up a large share of the bytes a visitor downloads, and a single oversized hero photo can delay the whole page. The good news is that image optimization is mostly about a few simple habits. This guide covers them in order of impact, and explains how they relate to Google’s Core Web Vitals.

Try it now: PNG to WebP ConverterFree, private and works in your browser.

Open PNG to WebP →

Why image size matters

Every image must be downloaded, decoded and drawn before the visitor sees it. On a fast office connection a few extra megabytes may not be noticeable, but many visitors browse on mobile data, older phones or crowded networks. Slow pages lose visitors, and Google uses page experience signals, including Core Web Vitals, as part of how it evaluates pages. Faster images help both people and search engines.

Core Web Vitals and images

  • Largest Contentful Paint (LCP) measures how quickly the largest visible element appears. On many pages this element is an image, such as a hero banner or featured image. Google considers an LCP of 2.5 seconds or less as good.
  • Cumulative Layout Shift (CLS) measures unexpected movement of content. Images without width and height attributes often cause text to jump when they load.
  • Interaction to Next Paint (INP) is about responsiveness. Images affect it less directly, but heavy pages keep the browser busy.

You can check your pages with Google’s free PageSpeed Insights, which also lists images that could be smaller.

Step 1: serve the right dimensions

The biggest win is not uploading images larger than they are displayed. If your content column is 800 pixels wide, a 4000-pixel image wastes bandwidth. A reasonable rule is to make images about as wide as their largest display size, and up to twice that for very sharp retina screens when the image matters, such as a product photo.

WordPress automatically creates several smaller copies of each upload and uses the srcset attribute so browsers can choose a suitable size. That helps, but it still starts from your original upload, so resizing huge camera files before uploading is still worthwhile. Use the image resizer with a maximum width such as 1600 or 2000 pixels.

Step 2: use modern formats

WebP is supported by all current major browsers and is usually smaller than JPG and PNG at similar quality. AVIF can be smaller still, but encoding is slower and support in editing tools is newer. For most sites, converting JPG and PNG images to WebP is a safe and effective step. Try JPG to WebP and PNG to WebP; transparent PNG logos keep their transparency in WebP.

Step 3: compress sensibly

A quality setting around 75 to 85 is a good starting point for photos on the web. Check important images visually; product photos and hero images deserve a little more quality than small thumbnails. If you have a page weight budget, set a target size per image in KB. Our WebP compressor and image compressor show the before and after size for each file.

Step 4: always set width and height

When the browser knows an image’s width and height in advance, it can reserve the correct space before the image downloads. This prevents layout shift. WordPress adds these attributes automatically for images inserted through the editor. In custom HTML, include width and height attributes, and use CSS like max-width:100%; height:auto so the image still scales on small screens.

Step 5: lazy-load images below the fold

Images that are not visible when the page first opens can wait. The native loading="lazy" attribute tells browsers to load those images only when the visitor scrolls near them. WordPress adds lazy loading to most content images by default. Do not lazy-load the main hero or featured image at the top of the page, because that can delay LCP.

Step 6: prioritise the LCP image

If your largest visible element is an image, help the browser find it early. Keep it in the HTML rather than loading it later with JavaScript, avoid lazy-loading it, and consider the fetchpriority="high" attribute on that one image. Recent WordPress versions add this attribute automatically to an image they detect as likely to be the LCP element.

Step 7: use a cache and a CDN

A caching plugin and a content delivery network (CDN) store copies of your images closer to visitors and send them with efficient caching headers. Many hosts with LiteSpeed servers include LiteSpeed Cache, which can also generate WebP versions automatically. These tools work best when the original images are already sensibly sized.

A practical checklist

  1. Resize originals to roughly the largest display width.
  2. Convert photos and graphics to WebP where your site supports it.
  3. Compress at quality 75 to 85 and check important images by eye.
  4. Make sure every image has width and height.
  5. Lazy-load images below the fold, but not the hero image.
  6. Write useful alt text for accessibility and image search.
  7. Re-test with PageSpeed Insights after changes.

Do not forget alt text

Alt text does not make a page faster, but it is part of a well-optimized image. It describes the image for screen-reader users and helps search engines understand it. Write a short, specific description such as “red running shoes on a wooden floor” rather than stuffing keywords.

Image optimization in WordPress

WordPress makes several improvements automatically, but a few habits help further. Upload images that are already resized to a sensible width, such as 1600 to 2000 pixels for full-width images. Recent WordPress versions accept WebP uploads, so you can upload WebP directly. If your host runs LiteSpeed, the LiteSpeed Cache plugin can generate WebP copies and serve them to browsers that support them. Avoid uploading the same image many times in different sizes; WordPress already creates the sizes your theme needs.

Background images and CSS

Images used as CSS backgrounds are not lazy-loaded by the browser’s native attribute and are discovered later than normal images. If a background image is the main visual at the top of a page, it can delay LCP. Where possible, use a normal image element for important visuals, and keep decorative backgrounds small or replace them with CSS gradients.

Icons and logos

Small icons and logos are often better as SVG, which stays sharp on every screen with a tiny file size. If you must use raster icons, export them at the size they are displayed, and at most twice that size for high-resolution screens.

Optimizing without uploading your files

All PixConvertly tools work in your browser, so you can resize, convert and compress a whole batch of website images without uploading them to another server. Download each file in its new format, or all together as a ZIP, then upload the optimized versions to your site.

Try it now: JPG to WebP ConverterFree, private and works in your browser.

Open JPG to WebP →

Frequently asked questions

What is the best image format for website speed?

WebP is the best general choice today: widely supported and usually smaller than JPG or PNG. AVIF can be smaller but has newer support.

What size should images be for a website?

About as wide as they are displayed, often 1200 to 2000 pixels for full-width images and smaller for thumbnails.

Should I lazy-load all images?

No. Lazy-load images below the fold, but load the main hero or featured image normally so it appears quickly.

Does WordPress optimize images automatically?

WordPress creates smaller sizes, adds srcset, lazy loading and dimensions, but it starts from your upload. Resizing and compressing before upload still helps.

How small should a web image be in KB?

There is no single rule. Aim for the smallest file that still looks sharp at its display size; check important images by eye.