Guide
Image optimization checklist for faster websites
Images are usually the heaviest part of a page. This checklist covers the changes that improve loading speed, layout stability and search visibility, in the order that matters.
A page can look simple and still ship four megabytes of images. That weighs on Largest Contentful Paint, eats mobile data and can push visitors away before the content appears.
Work through this list from top to bottom. Most sites see the largest gain from the first three items; the later items protect that gain and help search engines understand the images.
1. Start with dimensions, not compression
The most common image mistake is serving a 4000-pixel photo in an 800-pixel slot. Resize the file to the largest size it will actually display before you think about quality settings. A correctly sized image compressed at 80% will almost always beat a huge image compressed at 30%.
Keep one high-resolution master for future use and export web copies at the size the page needs.
Related:Resize image
2. Pick a modern format with a fallback
AVIF and WebP usually produce smaller files than JPEG at the same visual quality. Serve them through a picture element or a CDN that negotiates the format, and keep a JPEG or PNG fallback for older clients.
Do not convert flat logos or screenshots to lossy JPEG just because the file gets smaller. Use PNG or SVG for graphics with text and sharp edges.
Related:PNG to AVIF, AVIF to PNG, Image formats explained
3. Compress to the point of diminishing returns
For most photographs, a quality setting around 70 to 80 is hard to distinguish from the original at normal viewing size and much smaller. Compare at 100% zoom before committing, and avoid re-compressing the same file repeatedly.
Batch tools save time when a page has many images. Compress a copy, then replace the originals in the repository.
Related:Compress images
4. Write file names and alt text for people
Search engines use file names and alt attributes to understand what an image shows. They are also essential for screen readers and for visitors whose images fail to load.
Describe the content honestly. A file called red-running-shoes.jpg with alt text such as "Red trail running shoes on a gravel path" is useful. A list of keywords is not.
- Use lowercase, hyphen-separated file names that describe the image.
- Write alt text as a sentence fragment, not a paragraph.
- Use an empty alt attribute for purely decorative images so screen readers skip them.
- Do not repeat the page title in every alt attribute.
5. Serve responsive images
A single large file wastes bandwidth on phones and looks soft on high-density displays when sized wrong. Responsive images let the browser choose an appropriate file.
- Provide srcset variants at the widths the layout actually uses.
- Set the sizes attribute so the browser can pick correctly before layout.
- Always include width and height attributes to reserve space and prevent layout shift.
- Lazy-load images below the fold with loading="lazy".
- Do not lazy-load the hero or main content image; give it fetchpriority="high" instead.
6. Check Core Web Vitals after the changes
Largest Contentful Paint measures when the main content becomes visible, and images are often the LCP element. Aim for 2.5 seconds or less on mobile. Cumulative Layout Shift measures unexpected movement; aim for 0.1 or less.
Run Lighthouse or PageSpeed Insights on a representative page before and after the changes. Test on a throttled mobile profile, not just on a fast desktop connection.
The copy-paste checklist
Print this list or paste it into a pull request description.
- Images are no larger than the largest slot they render in.
- Modern formats are used with a fallback where needed.
- Every photograph is compressed at a sensible quality.
- File names are descriptive and hyphenated.
- Alt text exists for meaningful images and is empty for decorative ones.
- Width and height attributes are present.
- Below-the-fold images are lazy-loaded; the LCP image is not.
- Favicons and a 1200 x 630 social card exist.
- Lighthouse mobile LCP is under 2.5 seconds.
- CLS is under 0.1 on a real device.
Frequently asked questions
Do alt attributes help SEO?
They help accessibility first, and search engines use them to understand image content. Write honest descriptions for people rather than keyword lists.
Should every image be WebP?
Modern formats help, but compatibility and workflow matter. Use WebP or AVIF with a fallback when you can, and keep PNG or SVG for graphics that need crisp edges.
Does lazy loading hurt SEO?
No, when it is used below the fold. Avoid lazy-loading the hero or main content image, because that can delay the Largest Contentful Paint.
What size should a hero image be?
At least as large as the largest slot it renders in, and no larger than necessary. Export a few responsive widths and compress each one.
Do width and height attributes still matter?
Yes. They let the browser reserve space before the image loads, which reduces layout shift and improves the reading experience.
Continue reading
- Image file formats explainedA plain-language guide to JPG, PNG, WebP, AVIF, HEIC, SVG, GIF, TIFF and RAW: what each format is good for, and how to choose the right one.
- Favicon size guide: every icon you needThe favicon sizes that actually matter: 16, 32 and 48 px ICO, 180 px Apple touch icon, 192 and 512 px PWA icons, plus the HTML and manifest.
- PNG vs JPG: when to use eachPNG or JPG? Compare transparency, quality, file size and browser support, and learn which format fits photos, screenshots, logos and the web.