{"id":47757,"date":"2023-04-07T15:17:27","date_gmt":"2023-04-07T15:17:27","guid":{"rendered":"https:\/\/www.arimetrics.com\/glosario-digital\/lazy-loading"},"modified":"2026-10-01T16:27:54","modified_gmt":"2026-10-01T16:27:54","slug":"lazy-loading","status":"publish","type":"encyclopedia","link":"https:\/\/www.arimetrics.com\/en\/digital-glossary\/lazy-loading","title":{"rendered":"Lazy Loading"},"content":{"rendered":"<p><strong>Definition<img decoding=\"async\" class=\"boxpad alignright wp-image-47984 size-full\" src=\"https:\/\/www.arimetrics.com\/wp-content\/uploads\/2023\/04\/lazy-loading-1.jpg\" alt=\"Lazy loading\" width=\"300\" height=\"300\" srcset=\"https:\/\/www.arimetrics.com\/wp-content\/uploads\/2023\/04\/lazy-loading-1.jpg 300w, https:\/\/www.arimetrics.com\/wp-content\/uploads\/2023\/04\/lazy-loading-1-150x150.jpg 150w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/strong><\/p>\n<p><strong>Lazy loading<\/strong> is a technique that delays requesting or processing non-critical resources until they are likely to be needed. On a web page, it is commonly applied to images and iframes outside the initial viewport, although the same principle can be used for code and other components.<\/p>\n<p>Its purpose is to reduce the browser&#8217;s <strong>initial work<\/strong>. Resources are not necessarily loaded at the exact moment they enter the screen: the browser or page code may anticipate the request according to distance, connection, and other criteria.<\/p>\n\n<h2>How lazy loading works<\/h2>\n<p>When a page opens, the browser discovers its resources and determines when to request them. <strong>Priority elements<\/strong> are downloaded and processed from the beginning, while deferred elements remain pending until they approach the viewport or a defined implementation event occurs.<\/p>\n<p>This <strong>on-demand loading<\/strong> can reduce requests, transfer, and decoding during the initial phase. Its effect depends on how many resources are actually below the fold, their size, the cache, the device, and network speed.<\/p>\n<p>The usual behavior comprises these <strong>technical stages<\/strong>:<\/p>\n<ol>\n<li><strong>Discovery:<\/strong> The browser parses the <a href=\"https:\/\/www.arimetrics.com\/en\/digital-glossary\/html\">HTML<\/a> and recognizes elements marked for deferred loading.<\/li>\n<li><strong>Reservation:<\/strong> The layout preserves the space the resource will occupy to avoid unexpected movement.<\/li>\n<li><strong>Observation:<\/strong> The browser or a script monitors the element&#8217;s proximity to the viewport.<\/li>\n<li><strong>Request:<\/strong> The file is downloaded when the system estimates it will soon be needed.<\/li>\n<li><strong>Rendering:<\/strong> The resource is decoded, incorporated into the layout, and made available to the user.<\/li>\n<\/ol>\n<p>Deferred loading does not replace <strong>file optimization<\/strong>. An oversized image still uses more transfer and processing than necessary even when it is requested later.<\/p>\n<h2>Implementation methods<\/h2>\n<p>Modern browsers support <strong>native lazy loading<\/strong> for images and iframes through the `loading=&#8221;lazy&#8221;` attribute. This approach lets the browser choose an appropriate preload distance and avoids relying on a library for common cases.<\/p>\n<p>A <strong>deferred image<\/strong> can be declared as follows: <code>&lt;img src=\"image.jpg\" loading=\"lazy\" width=\"800\" height=\"600\" alt=\"Description\"&gt;<\/code>. Width and height attributes, or an equivalent aspect ratio in <a href=\"https:\/\/www.arimetrics.com\/en\/digital-glossary\/css\">CSS<\/a>, reserve space before the file loads and help limit layout shifts.<\/p>\n<p><a href=\"https:\/\/www.arimetrics.com\/en\/digital-glossary\/javascript\">JavaScript<\/a> remains useful when the logic requires <strong>specific control<\/strong>, custom components, conditional loading, or `IntersectionObserver`. In those cases, the content should remain accessible when the script fails or executes slowly.<\/p>\n<p>Code modules can also be split and requested through <strong>dynamic imports<\/strong>. Style sheets, fonts, videos, and interactive components require their own strategies; adding `loading=&#8221;lazy&#8221;` indiscriminately does not produce the same effect for every resource type.<\/p>\n<h2>Performance effects<\/h2>\n<p>When applied to content clearly below the fold, lazy loading may reduce <strong>initial bytes<\/strong> and processing. This can free bandwidth and reduce competition with resources needed to display the top of the page.<\/p>\n<p>The <strong>possible effects<\/strong> should be assessed separately:<\/p>\n<ul>\n<li><strong>Initial transfer:<\/strong> Files that the user may never request are postponed.<\/li>\n<li><strong>Network priority:<\/strong> Visible resources can compete with fewer secondary downloads.<\/li>\n<li><strong>Decoding:<\/strong> The browser postpones some work associated with images, iframes, or components.<\/li>\n<li><strong>Visual stability:<\/strong> Declared dimensions prevent content from shifting when a resource appears.<\/li>\n<li><strong>Later interaction:<\/strong> Insufficient anticipation may leave gaps or cause delays during scrolling.<\/li>\n<\/ul>\n<p>Lazy loading should not be applied to a <strong>hero image<\/strong> or other elements likely to appear in the initial viewport. Delaying the resource that determines Largest Contentful Paint may worsen that metric. The decision should form part of a <a href=\"https:\/\/www.arimetrics.com\/en\/digital-glossary\/wpo\">WPO<\/a> strategy rather than a global rule for every image.<\/p>\n<h2>SEO and accessibility<\/h2>\n<p>Lazy loading does not automatically improve rankings. It may contribute to an <strong>efficient page<\/strong>, but search engines still evaluate technical accessibility, content, links, and many other signals.<\/p>\n<p>For <strong>deferred content<\/strong> to be processed, it should not depend exclusively on actions such as swiping, clicking, or moving a pointer. Google recommends checking the rendered HTML and ensuring that images and text appear with valid URLs and attributes when the page is processed.<\/p>\n<p><strong>Alternative text<\/strong>, labels, controls, and semantic relationships remain necessary. An empty placeholder that is completed late can hinder navigation with assistive technology. Iframes and videos also require suitable names or descriptions and usable controls.<\/p>\n<p>The experience should be checked with slow JavaScript, network errors, and <strong>keyboard navigation<\/strong>. A robust implementation preserves essential information even when a secondary resource fails to load.<\/p>\n<h2>Measurement and common errors<\/h2>\n<p>Results are checked through an <strong>equivalent comparison<\/strong> of the page before and after. Laboratory tools help examine the network waterfall and priorities, while field data shows the behavior experienced by real users.<\/p>\n<p>Common <strong>lazy-loading errors<\/strong> include:<\/p>\n<ul>\n<li><strong>Deferring the LCP:<\/strong> Marking the hero image or an initially visible element as lazy.<\/li>\n<li><strong>Omitting dimensions:<\/strong> Failing to reserve space and causing layout shifts when the image appears.<\/li>\n<li><strong>Loading too late:<\/strong> Starting the request when the resource should already be visible.<\/li>\n<li><strong>Hiding content:<\/strong> Depending on interactions that crawlers or users cannot reproduce.<\/li>\n<li><strong>Measuring speed only:<\/strong> Ignoring transfer, visual stability, functionality, and real-user data.<\/li>\n<\/ul>\n<p>The <a href=\"https:\/\/www.arimetrics.com\/en\/digital-glossary\/cache\">cache<\/a>, responsive images, compression, and <strong>file sizes<\/strong> should also be checked. Lazy loading changes when a request occurs, but it does not independently fix heavy resources, unsuitable formats, slow servers, or poor page architecture.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Definition Lazy loading is a technique that delays requesting or processing non-critical resources until they are likely to be needed. On a web page, it is commonly applied to images and iframes outside the initial viewport, although the same principle can be used for code and other components. Its purpose is to reduce the browser&#8217;s [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"template":"","encyclopedia-tag":[1268],"class_list":["post-47757","encyclopedia","type-encyclopedia","status-publish","hentry","encyclopedia-tag-web-performance"],"_links":{"self":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/encyclopedia\/47757","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/encyclopedia"}],"about":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/types\/encyclopedia"}],"author":[{"embeddable":true,"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/users\/6"}],"wp:attachment":[{"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/media?parent=47757"}],"wp:term":[{"taxonomy":"encyclopedia-tag","embeddable":true,"href":"https:\/\/www.arimetrics.com\/en\/wp-json\/wp\/v2\/encyclopedia-tag?post=47757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}