Is your Magento 2 store slower than a sleepy sloth? Does your website's speed leave your customers tapping their fingers impatiently? In today's fast-paced digital world, website speed isn't just a luxury – it's a necessity. Slow loading times can lead to frustrated users, higher bounce rates, and ultimately, lost sales.
A key part of delivering a fast experience with Magento involves understanding and optimizing Google's Largest Contentful Paint (LCP) and Core Web Vitals (CWV) in general.


These metrics measure real-world user experience for loading performance, interactivity, and visual stability. One of the most critical Core Web Vitals affecting your website's performance and user experience is the Largest Contentful Paint (LCP). Especially for Magento 2 stores, optimizing LCP can be the key to unlocking faster load times, happier customers, and better search engine rankings.
This comprehensive guide will dive deep into LCP optimization specifically for Magento 2 stores, for both the traditional Luma theme as well as the modern, performance-focused Hyvä theme. We'll explore what LCP and other Core Web Vitals are, why they matter, how to measure them, and most importantly, provide actionable strategies and tools – including powerful extensions from JaJuMa – to help you supercharge your Magento 2 store's speed.
“In Magento's flow, swift speeds we seek,
Where Largest Content Paint must peak.
A dance of bytes, a seamless glide,
Peformance shines, no need to hide.
Measure, refine, each metric feeds,
The beauty of speed is all it needs.”
Why Core Web Vitals, Including Largest Contentful Paint (LCP), Matter For Magento 2 Stores
Largest Contentful Paint and the other Core Web Vitals are more than just technical terms; they are crucial indicators of how users perceive your website's loading speed, interactivity, and stability. Google uses LCP as a key metric in its Core Web Vitals, as ranking signals directly impacting your site's search engine ranking. You can find Google's official documentation on LCP here.
Here's why optimizing Core Web Vitals, with a focus on LCP, is particularly important for Magento 2 stores:
- User Experience:
A fast LCP means users see the most important content on the page quickly (loading performance). Good Interaction to Next Paint (INP) ensures the site responds quickly to clicks and taps (interactivity), while a low Cumulative Layout Shift (CLS) prevents annoying content jumps (visual stability). In e-commerce, this combination means the difference between a customer staying to browse or leaving for a competitor. -
Conversion Rates:
Faster loading times and a smoother interactive experience are directly correlated with higher conversion rates. Studies, like the one by Deloitte (https://www.deloitte.com/ie/en/services/consulting/research/milliseconds-make-millions.html), show that even millisecond improvements can significantly boost engagement and sales. -
SEO Ranking:
Google prioritizes websites that offer a good user experience. Good scores across all Core Web Vitals contribute to your overall Page Experience assessment, potentially boosting your visibility in search results and driving more organic traffic. -
Bounce Rate:
Slow-loading pages and unresponsive interfaces are a major reason for high bounce rates. If the main content takes too long to appear or the page feels sluggish, users are likely to give up and go elsewhere. Optimizing LCP and INP helps keep users engaged from the moment they land on your page.
What Are The Core Web Vitals?
Before diving deeper into Magento Largest Contentful Paint (LCP) optimization, let's quickly define the three main Core Web Vitals metrics:
- Largest Contentful Paint (LCP):
Focuses on loading performance. It measures the time it takes for the largest image or text block visible within the viewport to render, relative to when the page first started loading. Essentially, it marks the point when the main content of the page has likely loaded.
Google recommends an LCP of 2.5 seconds or less for a 'good' experience. - Interaction to Next Paint (INP):
Focuses on interactivity. It measures the latency of all user interactions (like clicks, taps, or key presses) throughout their visit to a page. The final INP score is the longest interaction observed (ignoring outliers). It indicates how quickly the page responds visually to user input.
A 'good' INP is considered 200 milliseconds or less.
(Note: INP replaced First Input Delay (FID) as a Core Web Vital in March 2024). - Cumulative Layout Shift (CLS):
Focuses on visual stability. It measures the sum total of all unexpected layout shifts that occur during the entire lifespan of the page load. A layout shift happens when a visible element changes its position from one rendered frame to the next.
A 'good' CLS score is 0.1 or less.
Optimizing all three Core Web Vitals is essential for providing a superior user experience on your Magento store.
This guide focuses primarily on LCP, but many optimization techniques positively impact INP and CLS as well.
The State of LCP and Core Web Vitals in Magento: Hyvä vs. Luma
Magento's default Luma theme, while functional, is known for its relatively heavy frontend which relies on extensive CSS (e.g., styles-m.css) and JavaScript libraries like KnockoutJS, jQuery, and RequireJS. This complexity can lead to challenges in achieving optimal LCP scores and often contributes to issues with render-blocking resources and potentially Cumulative Layout Shift (CLS), especially on mobile.
Hyvä theme for Magento 2, on the other hand, were built from the ground up with performance as a primary goal. By eliminating bulky libraries Hyvä adopts a modern architecture, with lightweight technologies like Tailwind CSS and Alpine.js, Hyvä-based stores significantly reduce the amount of code the browser needs to process. This streamlined approach typically results in drastically better LCP times and overall Core Web Vitals scores compared to Luma.
However, achieving really good and outstanding LCP values in real-life scenarios often requires additional optimizations also with Hyvä Theme.
Or from another view: Not applying additional optimizations for LCP with Hyvä Theme would be a missed chance to improve a store and its user experience.
While this guide provides strategies applicable to both Luma and Hyvä, users of Hyvä themes often have a significant head start due to the theme's inherent performance advantages. However, optimization is still crucial regardless of the theme.
To further simplify the journey towards LCP excellence and achieving those coveted top Google spots, a suite of measures and powerful tools are available for Magento and Hyvä Theme, e. g. in the form of JaJuMa Performance Optimization Extensions. These extensions are specifically designed to address various aspects of website performance, including image optimization, CSS delivery, and resource loading. By leveraging these readily available solutions, Magento merchants, agencies, and developers can implement LCP best practices with greater ease and efficiency, transforming complex optimization tasks into straightforward configurations.
Think of it as having a performance expert right within your Magento admin!
Understanding Largest Contentful Paint (LCP)
At its core, Largest Contentful Paint (LCP) measures how quickly the primary content of a web page becomes visible to the user.
As defined earlier, LCP measures the render time of the largest visible content element within the viewport. This element is often a hero image, a large banner, a video's poster image, or a significant block of text. LCP aims to capture when the main content of the page has likely loaded and become visible ('appeared') to the user.
The browser begins measuring LCP when the user initiates the page load and stops when the largest content element has been fully rendered and becomes visible. Understanding this definition is the first crucial step in effectively optimizing this metric, as it directs attention to the elements that have the most significant impact on perceived loading speed.
Google has established clear scoring thresholds for LCP to help website owners gauge their performance and understand the implications for their users and search engine rankings (Source).
- An LCP of 0 to 2.5 seconds is considered Good, indicating a fast and responsive user experience.
- Websites falling within the 2.5 to 4 seconds range are categorized as Needs Improvement, suggesting that while the site isn't critically slow, there's room for optimization to enhance the user experience.
- Finally, an LCP over 4 seconds is considered Poor, signaling significant loading performance issues that can negatively impact user satisfaction and SEO.


These benchmarks provide tangible targets for optimization efforts, allowing developers and merchants to assess their current standing and strive for the "Good" category to maximize search engine visibility.
Remember, a good LCP score is a strong signal to Google that your site provides a positive user experience, which can lead to better rankings.
How To Measure LCP?
Identifying the specific element that contributes to the LCP on your Magento 2 store with Luma or Hyvä is the essential first step in any targeted optimization strategy.
LCP and other CWV values can be measured in "the lab" using developer tools analyzing a single page load under specific conditions or in "the field" based on real user experiences on a site.


- Measuring LCP manually in "the lab":
Fortunately, modern browser developer tools provide straightforward ways to pinpoint this element, which is useful for debugging and testing changes. These tools simulate page loads in a controlled environment to analyze your page's performance and clearly indicate the LCP element along with its loading time. Examples include:
- Google Lighthouse:
Available in Chrome DevTools (F12 > Lighthouse tab). Provides a detailed performance audit, including LCP, INP simulation insights, and CLS. - Google PageSpeed Insights (PSI):
An online tool (https://pagespeed.web.dev/) that analyzes your page and provides both lab (Lighthouse) and field data (from CrUX, if available). - WebPageTest:
A powerful tool for in-depth performance analysis from various locations, devices, and connection speeds.
- Google Lighthouse:
- Field Tools (Real User Monitoring - RUM):
Priority should be measuring LCP in the field as it reflects the real user experience customers have in a Magento store.
Real User Monitoring (RUM) tools collect data from actual users visiting your site, providing a more accurate picture of real-world performance across different devices and network conditions. Examples include:
- Chrome User Experience Report (CrUX):
Public data collected from opted-in Chrome users. PageSpeed Insights and Google Search Console display this data.
You can visualize CrUX data for your site or competitors using tools like CrUXVis. - Google Search Console:
The Core Web Vitals report (under "Experience") shows how your pages perform based on CrUX field data, highlighting URLs needing improvement. - JavaScript Libraries:
Libraries like Google's web-vitals library allow you to collect CWV data directly from your users and send it to your own analytics tools (e.g., Google Analytics). - JaJuMa Real User Monitoring (RUM) Extension:
Our Real User Monitoring (RUM) Magento 2 extension simplifies monitoring, collecting and analyzing real-world LCP, INP, CLS and other performance data.
It provides up-to-date data, options for more detailed analysis and insights directly within your Magento admin for easy and convenient monitoring and analyis.
- Chrome User Experience Report (CrUX):
Key Factors Affecting LCP In Magento 2
Several factors can influence and delay the Largest Contentful Paint on a Magento 2 website with Luma or Hyvä.
Understanding these key drivers is crucial for developing effective optimization strategies and ultimately achieving those top Google spots as well as outstanding user experience.
-
Server Response Time (TTFB):
One of the most fundamental aspects affecting Magento LCP value is server response time (TTFB - Time to First Byte).
TTFB measures the time it takes for a user's browser to receive the first byte of data from the server after making a request. A slow TTFB acts as a bottleneck, delaying all subsequent loading processes, including the loading of the LCP element. If the server takes a long time to respond with the initial HTML, the browser cannot even begin to identify and request the resources needed to render the page, including the largest contentful element.
Therefore, optimizing server response time is a foundational step for improving LCP. -
Render-Blocking Resources:
Render-blocking resources, primarily CSS and JavaScript files, can significantly delay the rendering of the LCP element.
When the browser encounters these files in the HTML, it typically pauses the parsing of the document to download and process them. If these files are large or not optimized, they can block the browser from rendering any content, including significantly delaying the LCP element to from appearing, until they are fully processed.
Minimizing the impact of render-blocking resources is therefore crucial for ensuring a fast LCP. -
Media Optimization:
Given that images and videos are frequently the largest elements on a page, their slow loading is a common cause of poor LCP.
Large, unoptimized media files require significant time to download, and until they are fully loaded, they cannot be rendered as the LCP element.
Optimizing the size, format and loading of these media assets is therefore paramount for improving LCP, especially if the largest contentful element is an image or a video. -
JavaScript Execution:
JavaScript execution time can also play a critical role in LCP, particularly if JavaScript is used to render or manipulate the LCP element.
If the browser has to execute a significant amount of JavaScript before the LCP element can be displayed, this execution can block the main thread and delay the rendering process, even if the underlying resource (like an image) has already been downloaded.
LCP issues due to tied up main-thread are more common in themes heavily reliant on complex JavaScript frameworks (like Luma with KnockoutJS) or extensive client-side rendering.
Reducing the amount of main-thread work, JavaScript and optimizing its execution are important considerations for LCP (and also INP) optimization. -
Web Fonts:
Finally, web fonts can impact LCP if the largest contentful element is text styled with a custom font.
By default, browsers may delay rendering text styled with a web font until the font file has been downloaded, leading to a delay in the appearance of the LCP element.
Also If a large block of text is your LCP element, font loading strategy becomes critical.
Optimizing the loading of web fonts is therefore essential to ensure that text-based LCP elements are rendered promptly and also helps prevent layout shifts (CLS).
Actionable Strategies For LCP Optimization
Now, let's get practical and tackle those LCP Bottlenecks in your Magento 2 store.
Based on the factors discussed above, several proven actionable strategies can be implemented to optimize the Largest Contentful Paint on your Magento 2 store with Luma or Hyvä.
Continue reading to learn about proven and tested actionables to improve your LCP in Magento.
These strategies below align with general recommendations available for LCP optimization and are tailored for the Magento and Hyvä ecosystem.


By applying these measures, we managed to scrape off 50% from a LCP of 1.6 on Luma down to an incredible LCP of 0.8 on Hyvä - Check our Showcases linked below for more details and see the beauty of speed and performance optimization in action.
Your Best Friend: A Good TTFB (Time to First Byte)
Even with a perfectly optimized frontend, a slow server response will kill your LCP.
While focusing on the largest contentful element is crucial, a fast LCP is built upon a solid foundation of a quick Time to First Byte (TTFB). If the browser has to wait an extended period to receive the initial HTML document, it inherently delays the discovery and loading of all subsequent resources, including the LCP element.
-
Server Infrastructure:
For Magento 2 stores, particularly those using the performance-oriented Hyvä theme, selecting the right server infrastructure is paramount. Magento, being a robust e-commerce platform, benefits significantly from robust server resources. Hyvä, while lightweight on the frontend, still relies on efficient backend processing. Reviewing server logs and utilizing performance monitoring tools can help identify potential bottlenecks in server response times. Optimizing the Magento backend code and database queries, as well as ensuring your server configuration (such as using LiteSpeed or Nginx and the latest PHP version like 8.1+) is properly tuned, can lead to substantial improvements in TTFB. Furthermore, auditing third-party extensions and your theme files for any performance-intensive operations is crucial.
Ensure your hosting plan is adequate for your traffic. Consider upgrading to a more powerful server, a Magento-optimized hosting provider is a must (dedicated hosting is often better than shared). Server location matters too; choose one close to your primary audience. -
Content Delivery Network (CDN):
Implementing a Content Delivery Network (CDN) can be another effective way to reduce TTFB, especially for stores with a global customer base. A CDN stores cached copies of your website's static assets (like images, CSS, and JavaScript files) on servers distributed geographically around the world. When a user requests your site, the CDN serves these assets from the server closest to their location, minimizing server load, reducing latency and significantly improving response times. Numerous CDN providers are compatible with Magento 2 and Hyvä, making this a readily implementable solution. Popular options include Cloudflare, Fastly, and Amazon CloudFront.
Note: Keep in mind that using CDN might be a GDPR issue. -
Full Page Cache (FPC):
Optimizing caching is also critical for reducing server response times. Magento 2 offers built-in caching mechanisms like Full Page Cache (FPC), which should be properly configured and enabled. For even greater performance gains, consider using Varnish, a powerful HTTP reverse proxy and caching application that is highly recommended for Magento 2. Configuring FPC/Varnish to cache frequently accessed pages can dramatically reduce the load on your Magento server and lead to significantly faster TTFB for cached content. They serve pre-generated HTML pages directly from cache, bypassing much of Magento's backend processing for most visitors. Ensure your FPC is correctly configured and enabled.
In Magento Admin, check Stores > Configuration > Advanced > System > Full Page Cache. For Varnish, ensure it's selected as the Caching Application. -
Redis:
Utilizing redis, an in-memory data structure store, for caching database queries, sessions, and other frequently accessed data can also significantly improve performance.
-
Database Optimization:
Minimize and optimize database queries. Ensure database caches (like Redis or Memcached) are enabled and properly configured. Use indexing effectively.
-
Third-Party Module Audit:
Regularly audit third-party extensions. Poorly coded modules can significantly slow down server response time. Disable extensions one by one to identify culprits.
-
PHP & Magento Version:
Keep PHP and Magento updated to the latest stable versions, as they often include performance improvements. Run Magento in production mode.
-
BFCache/Preloading/Prerender:
While not directly for "cold loads" as analyzed e. g. in Google Pag Speed, leveraging Browser features such as Back/Forward Cache, Speculation Rules API and Page Preloading are highly effective options for reducing LCP and CWV field values and making navigation feel dramatically faster and provide a smoother perceived performance for customers after the initial first load, by aiming for near "zero-TTFB" on subsequent page loads.
Optimize Critical Rendering Path To Minimize Render-Blocking Resources
The critical rendering path is the sequence of steps the browser takes to render the initial view of a web page, that means convert HTML, CSS, and JavaScript into pixels on the screen.
Resources that block this path prevent the browser from painting the page quickly, directly impacting LCP.
-
Minifying CSS and JavaScript
Minifying CSS and JavaScript files is a fundamental optimization. Minification removes unnecessary characters (like whitespace and comments) from code, reducing file sizes.
Smaller files download faster and are parsed more quickly by the browser, allowing the LCP element to appear sooner.
Magento 2 has built-in configuration options for CSS and JavaScript minification in Stores > Configuration > Advanced > Developer. You can also enable merging, but test carefully as merging can sometimes break functionality or decrease performance depending on HTTP/2 usage. Use Magento CLI commands like bin/magento config:set dev/css/minify_files and bin/magento config:set dev/js/minify_files.
Hyvä Theme leverages CSS and JS minification by default. -
Inlining (Critical) CSS & Deferring Non-Critical CSS
Inlining critical CSS is a powerful technique to eliminate CSS as a render-blocking resource. Critical CSS is the minimal set of CSS required to style the content visible in the initial viewport (above-the-fold). By including this CSS directly within the <head> of your HTML document, the browser can render the above-the-fold content (which often includes the LCP element) without waiting for external CSS files to download. Identifying and inlining critical CSS can be a manual process or automated using various tools.
Magento has a built-in "CSS Critical Path" feature (Stores > Configuration > Advanced > Developer), but generating unique critical CSS per page requires custom solutions or extensions.Deferring non-critical CSS ensures that CSS not needed for the initial view doesn't block rendering . This can be achieved using the media="print" onload="this.media='all'" trick or by loading CSS asynchronously using JavaScript. By loading non-essential CSS later, the browser can prioritize rendering the LCP element.
For Hyvä themes, the Hyvä Inline CSS extension by JaJuMa takes this optimization a step further and provides a streamlined solution for this crucial optimization, making it significantly easier to implement. This extension fully automates the CSS optimization and generation per page/URL and adds all, but only used styles as inline CSS, making the need to load any CSS file as well as loading unused CSS obsolete. Note that Hyvä's architecture, leveraging Tailwind CSS, already minimizes CSS overheadfile sizes, making this extension even more effective.
Removing unused CSS is also crucial for performance. -
Defer Non-Critical JS Files
Similarly, async or defer attributes should be used for non-critical JavaScript files. The async attribute allows the script to be downloaded without blocking HTML parsing, and it will be executed as soon as it's downloaded (potentially out of order). The defer attribute also downloads the script without blocking parsing, but it will only be executed in order after the HTML has been fully parsed. Choosing the appropriate attribute depends on whether the script has dependencies or needs to execute at a specific time, e. g. needs to execute before or after the DOM is fully ready.
Magento allows moving JS to the bottom (Stores > Configuration > Advanced > Developer > JavaScript Settings > Move JS code to the bottom of the page), which acts similarly to deferring. However, test this carefully as it can break scripts relying on early execution. Exclude critical scripts if needed.
Note: With Hyvä Themes, this option should not be used.
Several Magento 2 extensions can help with deferring or bundling JavaScript . -
Preload Critical Resources & Assets
Preloading key resources via resource hints using the <link rel=preload> directive is another effective way to optimize the critical rendering path.
This tells the browser to fetch important resources like fonts, hero images (often the LCP element), and critical CSS/JS files with higher priority, even before they are discovered in the HTML. This ensures that these critical assets are available sooner, reducing the load time for the LCP element.
For example: <link rel="preload" href="/path/to/lcp-image.webp" as="image">
Use preconnect for critical third-party domains (e.g., CDNs, font providers) to speed up connection setup: <link rel="preconnect" href="https://your-cdn.com">.
The Preload Critical Resources & Assets extension by JaJuMa simplifies the implementation of resource hints like preload and preconnect, allowing for easy configuration of which critical assets should be prioritized.
Another option to boost the loading priority of hero images / LCP is to use fetchpriority="high".
For example: <img src="/path/to/lcp-image.webp" fetchpriority="high">.
The Ultimate Image Optimizer by JaJuMa allows to add this attribute to optimized images easily.
Implement Code Splitting And Progressive Loading Techniques
Loading all JavaScript, CSS, and content upfront isn't always necessary or efficient.
These techniques focus on delivering only the necessary code and resources initially, improving the initial load time and potentially the LCP.
-
JS Bundling & Code Splitting
Splitting JavaScript bundles involves breaking down large JavaScript files into smaller, more manageable chunks based on routes, pages, or components. This allows the browser to download and execute only the JavaScript that is needed for the current page, reducing the initial payload and improving performance.
While Hyvä's minimal JavaScript approach inherently eliminates the need for splitting compared to Luma, optimizing Magento 2's JavaScript bundling configurations can still yield benefits for Luma.
Magento's built-in JavaScript bundling can sometimes create very large files. While intended to reduce requests, it can negatively impact LCP and INP if the bundle is too big, blocks rendering, or causes excessive main-thread work. Advanced bundling tools (like MagePack) or strategies focusing on splitting bundles based on page type or functionality might be more effective, especially for complex stores. The goal is to load only the necessary JavaScript for the current view initially. -
Lazy Loading
This technique defers the loading of offscreen resources (especially images and iframes) until the user scrolls near them. This prioritizes loading critical above-the-fold content first, significantly improving initial load times and LCP if the LCP element itself is not lazy-loaded. Native browser lazy loading (loading="lazy" attribute on <img> and <iframe> tags) is widely supported and easy to implement (It is crucial to avoid lazy loading the LCP element itself, as this would directly delay its appearance):
<img src="image.jpg" loading="lazy" width="200" height="200" alt="...">
Ensure you provide width and height attributes to prevent layout shifts (CLS).
This reduces the initial page load time by deferring the loading of resources that are not immediately visible.
Both the Ultimate Image Optimizer and the WebP Optimized Images extensions by JaJuMa offer easy-to-configure lazy loading for images, with the essential option to exclude specific images (like the LCP element) from being lazy-loaded . -
Placeholders
Using lightweight placeholders (e.g., solid color blocks, blurred low-quality images (LQIP), or reserving space with CSS) for images, videos, and other dynamically loaded content while they load can improve perceived performance, make the wait feel shorter and prevent layout shifts (CLS).
Optimizing Common LCP Elements: Images, Banners, and Media
Since the LCP element is frequently an image, banner, or video placeholder, optimizing these media assets is paramount.
Beyond lazy loading offscreen content, focus on the LCP element itself:
- Identify the LCP Element:
Use tools like PageSpeed Insights or Lighthouse to pinpoint exactly which element is the LCP on key page types (homepage, category page, product page).
It might be a banner image, the main product image, or even a text block. - Prioritize LCP Loading:
Ensure the LCP image is discovered and loaded as early as possible.- Avoid Lazy Loading the LCP Image:
Never apply loading="lazy" to your main LCP image if it's visible above the fold. - Use Preload:
Use <link rel="preload" as="image"> for the LCP image source (ensure it matches the srcset source used, if applicable). - Use Fetch Priority:
Add fetchpriority="high" to the LCP <img> tag to signal its importance to the browser.
- Avoid Lazy Loading the LCP Image:
- Optimize Image Files:
- Compression:
Use effective compression tools (like TinyPNG online or server-side tools) to reduce file size without sacrificing visual quality.
Or better skip this step and apply the compression when generating next-generation formats WebP or AVIF - see next point. - Modern Formats:
Serve images in next-generation formats like WebP or AVIF, which offer better compression than traditional JPG or PNG.
Use the <picture> element or server negotiation to provide fallbacks for older browsers.
Example:
<picture>
<source srcset="image.avif" type="image/avif">
<source srcset="image.webp" type="image/webp">
<img src="image.jpg" alt="..." width="1000" height="500" fetchpriority="high">
</picture> - Responsive Images (srcset and sizes):
Serve appropriately sized images based on the user's viewport and device resolution using the srcset and sizes attributes.
Avoid serving huge desktop-sized images to mobile users. - Explicit Dimensions:
Always specify width and height attributes on <img> and <video> tags to prevent layout shifts (CLS) as the media loads. -
LQIP (Low-Quality Image Placeholder):
Consider using LQIP (Low-Quality Image Placeholder) to improve perceived performance. This involves displaying a very small, low-resolution version of the image while the full-quality image is loading. This provides immediate visual feedback to the user, making the loading process feel faster. The Ultimate Image Optimizer offers various LQIP options, including blurred versions and color-based placeholders.
- Compression:
- Video Optimization:
If a video is part of the LCP (usually its poster image), ensure the poster image itself is optimized like any other image. Defer the loading of the actual video player JavaScript until needed. - Use a CDN:
Deliver images and videos via a Content Delivery Network (CDN) for faster delivery from servers closer to the user.
The Ultimate Image Optimizer by JaJuMa and WebP Optimized Images by JaJuMa extensions can automate many of these image optimization tasks within Magento.
Reduce JavaScript Execution And Main Thread Blocking Time
Long-running JavaScript tasks, due to excessive or inefficient JavaScript can block the main thread, delaying rendering (impacting LCP) and making the page unresponsive to user input (impacting INP).
- Audit & Remove Unused JS:
Identify and remove any JavaScript code, libraries, or third-party scripts that are not essential for the page's core functionality or for the initial view. - Optimize Third-Party Scripts:
Load third-party scripts (analytics, chat widgets, ads, tag managers) asynchronously (`async`) or defer (`defer`) them. Consider if they are truly necessary on every page load, as they often impact performance significantly. Filter scripts to load only when needed. - Code Splitting:
Break down large JavaScript bundles into smaller chunks that load only when needed (e.g., load JavaScript for a popup only when the popup is triggered). - Minimize Main-Thread Work: Optimize complex calculations or long-running JavaScript tasks. Break long tasks (over 50ms) into smaller ones using techniques like `setTimeout` to yield control back to the browser. Consider using web workers to move non-UI tasks off the main thread.
- Reduce DOM Size:
An excessively large Document Object Model (DOM) increases memory usage and slows down rendering and script interactions. Avoid creating unnecessary DOM elements. - It's worth noting that the Hyvä theme's core philosophy of using minimal JavaScript (primarily Alpine.js) inherently contributes to reducing JavaScript execution time compared to more traditional Magento themes. This lightweight approach provides a significant advantage in minimizing JavaScript-related performance bottlenecks. While JaJuMa doesn't offer a specific extension for general JavaScript optimization, utilizing their extensions for CSS inlining (Hyvä Inline CSS) and image optimization (Ultimate Image Optimizer, WebP Optimized Images) can indirectly reduce the workload on the main thread.
Leverage Back/Forward Cache, Preloading And Prerendering For Instant Loads
Beyond optimizing the initial load, speeding up subsequent navigations significantly enhances the overall user experience and Core Web Vitals field data:
- Browser Caching:
Ensure static assets (CSS, JS, images, fonts) are served with appropriate cache headers (e.g., `Cache-Control: max-age=...`) so browsers can store them locally and avoid re-downloading them on subsequent visits. Configure cache lifetimes effectively. - Back/Forward Cache (BFCache):
This browser optimization allows for instant loading of previously visited pages when using the back/forward buttons. Ensuring your pages are BFCache-compatible (avoiding `unload` event listeners, etc.) can dramatically improve navigation speed. The Back Forward Cache (bfcache) Extension for Magento 2 helps enabling the bfcache, ensuring compatibility and avoiding UX issues as well as with private/stale data being displayed. - Preloading/Prerendering Next Navigations:
Techniques like `<link rel="prefetch">` or the newer Speculation Rules API (Chromium browsers only) allow the browser to start fetching or even fully render pages the user is likely to visit next during idle time. This can make subsequent page loads feel instantaneous. JaJuMa offers extensions like Smart Speculation Rules and Page Preload to implement these strategies easily in Magento 2. - Preloading via Resource Hints:
As mentioned earlier, preloading key resources with <link rel=preload> is crucial for ensuring critical assets like the LCP image or font are fetched early. The Preload Critical Resources & Assets extension by JaJuMa simplifies the implementation of this technique . - Service Workers:
Service Workers can intercept network requests and serve precached or prerendered responses, leading to faster loading, especially on subsequent visits.
While implementing Service Workers can be more complex, they offer significant performance benefits.
Optimize Web Fonts For Faster Text Rendering
If your LCP element includes text styled with a web font or if fonts cause layout shifts (CLS), optimizing font loading is essential.
- Font Loading Strategy:
Use `font-display: swap;` in your `@font-face` declarations. This tells the browser to initially display text using a fallback system font and then swap to the custom font once it loads. This avoids invisible text (FOIT) and ensures content is readable quickly, improving perceived LCP for text elements. It also helps prevent CLS caused by font swaps. - Preload Fonts:
Preload critical font files (especially WOFF2 format) using `<link rel="preload" as="font" type="font/woff2" crossorigin>`.
Focus on the fonts and weights needed for above-the-fold content.
This can be easily configured using the Preload Critical Resources & Assets extension by JaJuMa. - Font Formats:
Use modern, efficient font formats like WOFF2, which offers the best compression. - Self-Host Fonts vs. Third-Party:
Hosting fonts on your own server (and serving via your CDN) often provides more control and potentially better performance than relying on third-party font services (like Google Fonts), especially if you optimize caching and use a CDN. Consider using system fonts (see tip below) to avoid web font loading altogether if design allows. - Subset Fonts:
If using custom fonts, subset them to include only the characters (glyphs) actually used on your site, significantly reducing file size. - Variable Fonts:
Consider using variable fonts, which can contain multiple weights and styles within a single file, potentially leading to smaller file sizes compared to loading individual font files for each weight and style.
Monitor And Measure LCP In The Field And In The Lab
Continuous monitoring and measurement are crucial for identifying LCP issues and tracking the impact of your optimization efforts.
Continuously track the impact of any new features or performance optimizations on your LCP score. This helps you understand what works and what doesn't.
Analyze the LCP element itself to understand what is contributing to the loading time. Focus your optimization efforts on this specific element.
Remember to prioritize field data over lab data, as field data reflects the actual user experience. While lab tools are valuable for debugging, real-world conditions can vary significantly.
-
Field Data - Real User Monitoring (RUM):
Utilize RUM (Real User Monitoring) tools to collect real-world LCP data from your actual users. This provides valuable insights into how your website performs under real-world conditions. The Real User Monitoring (RUM) extension (currently in beta) and the Real User Monitoring (RUM) Power Toy by JaJuMa aim to provide this crucial field data directly within the Magento environment together with details and guidance for identifying and prioritizing further optimizations. -
Lab Data - Lab Tools:
Leverage lab tools like Lighthouse and Chrome DevTools to measure LCP in a controlled environment during development and testing.
These tools provide detailed performance reports and recommendations for improvements.
The Ultimate Magento 2 Luma & Hyvä LCP Optimization Checklist With JaJuMa Extensions
Below is an easy-to-read checklist table that summarizes key optimization areas and highlights JaJuMa extensions providing automated or enhanced solutions to help you quickly review and implement the recommended optimizations:
Optimization Technique |
Magento 2 Implementation | JaJuMa Extension(s) | Priority |
---|---|---|---|
Optimize TTFB | Choose optimized hosting, configure CDN, enable Magento & Varnish/Redis caching, minimize redirects, audit third-party extensions/themes | Back/Forward Cache, Speculation Rules API and Page Preload (for subsequent loads) |
High |
Minify CSS & JS | Luma: Enable minification in Magento admin Hyvä: Use build tools for Hyvä |
N/A | High |
Inline (Critical) CSS | Luma: Identify and inline critical CSS manually or using online tools. Hyvä: Inline all used CSS |
Hyvä Inline CSS |
High
|
Defer Non-Critical CSS |
Luma: Use media attribute or JavaScript-based loading. Hyvä: Not needed |
N/A | Medium |
Async/Defer Non-Critical JS |
Use async or defer attributes on <script> tags, consider Magento 2 extensions for this | N/A | Medium |
Preload Key Resources |
Use <link rel=preload> for LCP image, fonts, critical CSS/JS, fetchpriority="high" for hero images |
Preload Critical Resources & Assets and Ultimate Image Optimizer |
High |
Lazy Load Non-LCP Images |
Implement lazy loading using browser APIs | Ultimate Image Optimizer, WebP Optimized Images (with LCP exclusion) | High |
Adopt Next-Gen Image Formats |
Convert images to WebP and AVIF | Ultimate Image Optimizer, WebP Optimized Images | High |
Responsive Images |
Use srcset and <picture> elements with responsive image versions | Ultimate Image Optimizer | High |
Provide Image Width/Height |
Add width and height attributes to <img> tags | Ultimate Image Optimizer | High |
Consider LQIP | Implement Low-Quality Image Placeholders | Ultimate Image Optimizer | Medium |
Audit/Trim Unused JS |
Use browser developer tools to identify and remove unnecessary code | N/A | Medium |
Break Up Long JS Tasks |
Refactor code to split long-running tasks | N/A | Medium |
Optimize Web Fonts |
Self-host fonts, use font-display: swap, preload critical fonts, subset fonts. Better: Avoid Web Fonts, use System Fonts. Use SVG Icons instead of Icon Fonts |
Preload Critical Resources & Assets Icon Pack extensions for Hyvä Theme |
High |
Bfcache/ Prefetch/ Prerender Links |
Implement Speculation Rules for Chromium Browsers Implement page preloading techniques for other Browsers |
Back/Forward Cache, Smart Speculation Rules and Page Preload |
High |
Monitor LCP (Field & Lab) |
Use tools like Lighthouse, Chrome DevTools + Real User Monitoring | Real User Monitoring (RUM), Real User Monitoring (RUM) Power Toy, Core Web Vitals Power Toy |
High |
Supercharging Your Magento Store: How JaJuMa Extensions Simplify LCP And CWV Optimization
While many LCP and Core Web Vitals optimizations can be done manually using native Magento features or custom code, it often requires significant technical expertise, development time, and ongoing effort to implement and maintain effectively. JaJuMa's suite of Performance Optimization Extensions for Magento 2 (compatible with both Luma and Hyvä, with some specifically designed for Hyvä) automates and simplifies many of these critical tasks, offering convenience, advanced features, and faster results compared to manual methods:
The Ultimate Image Optimizer stands out as a comprehensive solution for image-related LCP optimizations. It automates the conversion of images to next-generation formats like WebP and AVIF, generates responsive images for various devices, and ensures that crucial width and height attributes are automatically added to prevent layout shifts. Furthermore, it offers built-in lazy loading functionality for off-screen images while providing the essential option to exclude your LCP element from lazy loading, ensuring it loads immediately. The extension also supports high-priority loading for designated LCP images and offers various Low-Quality Image Placeholder (LQIP) options to improve perceived performance.
For Hyvä theme users, the Hyvä Inline CSS extension provides a straightforward way to tackle render-blocking CSS. By automating the process of identifying and inlining critical CSS, this extension eliminates a complex manual task and ensures that all and only the CSS necessary for rendering a page is delivered directly within the HTML, leading to faster initial rendering and improved LCP.
While not directly impacting the initial LCP, extensions like Back/Forward Cache, Speculation Rules API and Page Preload contribute to a significantly faster and more seamless user experience by speeding up navigation. This improves the overall perception of your store's performance and directly impacts Core Web Vitals field values positively.
The Preload Critical Resources & Assets extension simplifies the implementation of resource preloading, a vital technique for improving LCP. With this extension, you can easily configure which critical assets, such as your LCP image, key fonts, or critical CSS and JavaScript files, should be preloaded, ensuring they are fetched by the browser as early as possible. This extension also allows for configuring DNS prefetch and preconnect for third-party domains.
Finally, the Real User Monitoring (RUM) extension provides valuable insights into your store's LCP performance, Core Web Vitals as well as other prformance KPIs and errors as experienced by real users, enabling you to make data-driven decisions for further optimization.
By leveraging these tools, you can achieve significant LCP and overall Core Web Vitals improvements more efficiently, freeing up time to focus on other aspects of your business. They provide a streamlined path compared to potentially complex manual configuration and development.
JaJuMa LCP Optimization Extensions Case Studies
Don't just take our word for it! See how our extensions have helped real Magento stores achieve dramatic LCP and overall performance improvements.
Check out our case studies/showcases below to see our performance optimization extensions for top LCP values in action.
A Largest Contentful Paint of 0.8 seconds for both a newly launched shop and a migration from Luma to Hyvä is impressive, right?
LCP Optimization Showcase:
Major Performance Gains for Flowers Retailer with Hyvä
Challenge: Project rescue Luma to Hyvä migration - achieving outstanding Largest Contentful Paint and Performance on a breath-taking low budget.

Solution: Implemented JaJuMa's suite of Largest Contentful Paint optimization extensions and custom performance optimization development services.
-
CLS-100% 0.0
-
LCP-50% 0.8
-
FCP-46% 0.7
-
TTFB-55% 0.4
LCP Optimization Showcase:
Quick Hyvä Magento Launch for Weihnachtsstollen.de
Challenge: Launching a high-performance Magento store with in record time. On a budget, without compromising, but going "beyond 'only green' Core Web Vitals," ensuring exceptional Largest Contentful Paint optimization right from launch day.

Solution: Leveraged JaJuMa's ready-to-use Largest Contentful Paint optimization extensions and custom performance optimization development services.
-
CLS0
-
LCP0.8s
-
FCP0.7s
-
TTFB0.4s
FAQ: Your Questions Answered On Magento 2 LCP Optimization
Key Takeaways
- Core Web Vitals (LCP, INP, CLS) are crucial: They directly impact user experience, SEO rankings, and conversion rates for Magento stores.
- Hyvä Advantage: Magento's Luma theme often presents Core Web Vitals challenges; Hyvä provides a fast foundation for LCP & CWV optimization due to their lightweight architecture.
- Key LCP Factors: Include TTFB, render-blocking resources, resource load times (especially images/banners), JS execution (main-thread work), and font loading.
- Optimize LCP: Through server improvements (hosting, CDN, caching like Varnish), critical path optimization (minify, inline CSS, defer JS, preload), prioritized LCP element loading (`fetchpriority`, no lazy load), media optimization (formats, compression, responsive images, lazy load offscreen), and font strategies (`font-display: swap`, preload).
- Many optimizations for LCP also positively impact INP: E.g., reducing JS execution and CLS (e.g., image dimensions, font optimization).
- JaJuMa Power: Manual optimization is possible but can be complex; JaJuMa extensions can automate and simplify many LCP/performance best-pactices and optimization tasks for both Luma and Hyvä.
- Focus on TTFB: A fast server response is essential for a good LCP.
- Optimize Images: Use next-gen formats, responsive images, and avoid lazy loading the LCP element.
- Minimize Blocking Resources: Inline (critical) CSS and defer non-critical CSS/JS.
- Monitor Regularly: Track your LCP score using field (RUM) and lab tools (Lighthouse) to ensure your optimizations are effective and to maintain good scores.
Conclusion
Optimizing Largest Contentful Paint and all Core Web Vitals is no longer optional for serious Magento 2 store owners.
It's a fundamental aspect of providing a positive user experience, maximizing conversions, and achieving strong SEO performance.
While the journey might seem complex, especially with the Luma theme, understanding the key factors and implementing targeted strategies – potentially accelerated by tools like JaJuMa extensions and the performance foundation of Hyvä themes – can lead to significant improvements.
Start by measuring your current Core Web Vitals, identify your biggest bottlenecks (paying close attention to LCP, INP, and CLS), and implement the strategies outlined in this guide. Remember that performance optimization is an ongoing process, so keep monitoring, testing, and refining your approach to keep your Magento 2 store running at lightning speed and delivering an excellent user experience that meets Google's standards.
We encourage you to take the steps outlined in the checklist and explore how JaJuMa extensions can help you supercharge your Magento 2 store with Hyvä or Luma.
Visit the JaJuMa website at Performance Optimization Extensions to learn more and start optimizing your store's performance today.
Ready To Boost Your Magento 2 Store's Speed and Core Web Vitals?
Looking to achieve top Google rankings and excellent user experienece?
Start implementing these LCP optimization techniques today and see the difference in your user experience and SEO!
Explore JaJuMa's Performance Optimization Extensions or contact us for expert Magento performance tuning services:
From developing powerful stores to optimizing your performance and customizing your system’s extension – JaJuMa offers comprehensive Magento services that drive your business forward. Let’s achieve your goals together! Contact us for a free & non-binding consultation.