HTML Tools

Image Loading Attribute Builder

Choose an image use case and get a complete img tag with the right combination of loading, decoding, fetchpriority, width, height, and alt attributes. Covers hero images, thumbnails, article images, and galleries.

Loading tool...

What is Image Loading Attribute Builder?

Modern img tags benefit from several performance attributes used together: loading controls lazy loading, decoding controls how the image is decoded, and fetchpriority signals importance. Using them correctly together is better than setting them in isolation.

Quick answer

Use loading='lazy' for below-the-fold images to defer loading until the user scrolls near them. Use loading='eager' or omit the attribute for above-the-fold images that should load immediately.

Limitations

  • Lazy loading defers image requests but does not reduce total page weight -- images still download when scrolled into view.
  • The browser reserves placeholder space for lazy images even before they load, which can affect layout if width and height attributes are missing.
  • Using loading='lazy' on above-the-fold images can delay LCP and hurt user experience.

How to use this tool

  1. Choose the image use case that matches where the image appears on the page.
  2. The tool sets the recommended attribute combination for that use case.
  3. Enter the image path, dimensions, and alt text.
  4. Copy the complete img tag into your page.

What you can use it for

  • Build a hero img with loading='eager', decoding='sync', and fetchpriority='high'.
  • Create lazy-loaded article images with loading='lazy' and decoding='async'.
  • Optimize thumbnail galleries with appropriate loading and decoding attributes.

Use cases

Practical examples

Example

LCP hero image tag

An LCP hero image gets loading='eager', decoding='sync', and fetchpriority='high' for fastest possible render.

Example

Below-the-fold article image

A below-the-fold article image gets loading='lazy', decoding='async', and no fetchpriority to avoid competing with critical resources.

Common mistakes

  • Using loading='lazy' on the LCP image which delays it significantly.
  • Setting decoding='sync' on every image instead of only the critical ones.
  • Using fetchpriority='high' on multiple images which dilutes the priority hint.

Verification

  1. Open Chrome DevTools Network panel and scroll the page to confirm lazy images only load when they enter the viewport.
  2. Check the Performance panel and verify that above-the-fold images with loading='eager' appear in the initial request waterfall.

FAQ

Questions about Image Loading Attribute Builder

When should I use loading='lazy'?

For images that are below the fold and not essential for the initial page render. Never use it on the LCP image.

What does decoding='async' do?

It tells the browser to decode the image asynchronously, allowing other content to render first before the image finishes decoding.

Related tools

More html tools

Also try

Also try