Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsFor images below the initial viewport, add loading="lazy" to the <img> element and include its dimensions. Keep the hero or other important image visible on first load eager so it can load promptly. Native lazy loading can reduce early image requests, but it does not shrink image files or guarantee a particular speed improvement.
Use native lazy loading for below-the-fold images
For an ordinary image that is not initially visible, use the browser-managed loading attribute:
As an Amazon Associate I earn from qualifying purchases.
<img
src="/images/article-photo.jpg"
width="1200"
height="800"
loading="lazy"
alt="A description of the image"
>
Replace the path, dimensions, and alternative text with values for your image. The width and height should reflect its intrinsic dimensions or at least the same aspect ratio. The browser defers fetching a lazy image until it is within a browser-calculated distance of the viewport; the attribute does not let you set that distance. MDN describes the feature as widely available: HTMLImageElement: loading property.
Choose lazy or eager by the image’s role
- Use
loading="lazy"for non-critical images well below the initial viewport. - Leave
loadingoff, or setloading="eager", for images initially visible or important to the first screen, especially the likely Largest Contentful Paint (LCP) image.
Do not lazy-load every image indiscriminately. Deferring a visible hero image may delay the page’s main content, while off-screen images may never be requested if the reader does not scroll to them. MDN’s guidance on improving LCP explains the importance of making the principal image available promptly: Optimize Largest Contentful Paint.
#1 Best Overall
Prevent image loading from shifting the page
Give each image accurate width and height attributes, as in the example above, or reserve the same aspect-ratio space in CSS. The browser can calculate the ratio before the file arrives and allocate room in the layout. Without known dimensions, an unloaded lazy image can initially have a zero-sized box, then push nearby content aside when it loads. See MDN’s <img> reference.
Lazy loading does not choose or optimize the image file
loading="lazy" controls when an image is fetched, not how many bytes it takes to download. For responsive images, provide candidates with srcset and a sizes description so the browser can select an appropriate source. Use <picture> when you need art direction or format alternatives. MDN’s responsive images guide explains these options.
<img
src="/images/photo-800.jpg"
srcset="/images/photo-400.jpg 400w, /images/photo-800.jpg 800w, /images/photo-1200.jpg 1200w"
sizes="(max-width: 600px) 100vw, 800px"
width="1200"
height="800"
loading="lazy"
alt="A description of the image"
>
The values in srcset and sizes must match the images and layout on your site; this example is a pattern, not a universal sizing formula. Avoid using JavaScript to swap in a smaller source only after detecting that an image is near the viewport. The browser might already have started downloading the original, resulting in an unnecessary second request. Compression, format choice, and suitable image dimensions are complementary decisions; there is no single format or compression setting that fits every site. MDN covers these considerations in its image guide.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Rank #2
When to use JavaScript instead
For ordinary image deferral, native loading="lazy" is simpler: the browser handles proximity and scheduling. Use an Intersection Observer when your application needs custom behavior based on an element entering or leaving the viewport, such as triggering a coordinated interface change. The available guidance does not establish a general performance advantage for a JavaScript observer over native loading.
Frameworks and content management systems may expose their own image components or settings. Their configuration depends on the platform; apply the same principles—defer non-critical off-screen images, keep critical images promptly discoverable, and reserve layout space.
Priority hints for important images
If an important image needs an explicit priority hint, fetchpriority="high" can signal that the browser should prioritize it relative to other resources:
Rank #3
- Used Book in Good Condition
<img
src="/images/hero.jpg"
width="1600"
height="900"
fetchpriority="high"
alt="A description of the hero image"
>
Use the hint sparingly, usually for a key image such as the likely LCP image. It is a browser hint, not a way to reduce file size, and it does not replace responsive image selection. MDN marks fetchPriority newly available since October 2024 and notes that older browsers may not support it: HTMLImageElement: fetchPriority property.
Check behavior and diagnose common problems
Verify loading in the browser
- Inspect the rendered image element and confirm it has
loading="lazy"only when it is intended to be deferred. - Confirm the element has width and height attributes or equivalent reserved space in CSS.
- Use your browser’s developer tools network panel to see when image requests begin as you load the page and scroll. Compare with the same page without lazy loading; results depend on the page, image set, browser, and network, so do not assume a fixed percentage gain.
- Check that responsive candidates are available and that the browser is not downloading an unnecessarily large source for the rendered size.
Image appears late or the main content is delayed
If an image is visible immediately but arrives late, remove loading="lazy" or use loading="eager". For a genuinely important image, consider fetchpriority="high" as a hint. Also check whether the selected source is larger than needed; priority does not make a file smaller.
Content jumps when an image appears
Add accurate dimensions or reserve the image’s aspect ratio in CSS. Check that the reserved ratio matches the delivered image; a mismatch can still cause layout changes.
Rank #4
All images load immediately, or a lazy image is still missing
Native lazy loading is deferred only when JavaScript is enabled, as an anti-tracking measure. Also remember that the browser—not the HTML attribute—decides how near the viewport an image must be before fetching it. Do not depend on a fixed pixel threshold. MDN describes these caveats in its lazy-loading guide.
The window load event fired, but an image is not complete
A lazy image can still be pending when the window’s load event fires. If application code needs to know whether a particular image completed, inspect that image’s complete property rather than treating the window event as proof that every image is ready. The same MDN lazy-loading guide documents this behavior.
Recommended Free Tools
Or skip the browser setup
For a rendered screenshot of a page, ScreenshotNeo offers a one-call API instead of setting up a browser capture workflow. For example, this cURL request saves a WebP screenshot of a page:
Best Value
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. It also has an MCP server so AI agents can take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. ScreenshotNeo is a website screenshot API and MCP server from ScreenshotNeo; it captures rendered pages rather than changing your site’s image-loading behavior.
Sign up for 1,000 free screenshots a month, with no card required.
Frequently Asked Questions
Does loading="lazy" guarantee a faster page?
No. It can defer unnecessary early image requests, but the effect depends on the page, images, network, and browser.
Can I lazy-load a background image in CSS with the same attribute?
No. The loading attribute shown here applies to HTML image elements; CSS background images need a different implementation if they require deferred loading.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




