{"id":92324,"date":"2023-08-24T10:24:54","date_gmt":"2023-08-24T10:24:54","guid":{"rendered":"\/tutorials\/?p=92324"},"modified":"2026-03-09T19:17:47","modified_gmt":"2026-03-09T19:17:47","slug":"interaction-to-next-paint","status":"publish","type":"post","link":"\/ng\/tutorials\/interaction-to-next-paint","title":{"rendered":"INP: Understanding the New Core Web Vitals Metric and How to Optimize for It"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>Interaction to Next Paint (INP) is one of the performance metrics Google has introduced to measure web pages&rsquo; responsiveness.<\/p><p>If you want to improve your site&rsquo;s search engine rankings, understanding what is INP and how to optimize for it is crucial. Otherwise, your pages may rank lower in search results.<\/p><p>This article will look into INP in more detail &ndash; including how it differs from other Core Web Vitals metrics and how to measure it to improve your current score.<\/p><figure class=\"wp-block-image size-large\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/How-to-Speed-Up-Your-Website-EN.pdf\"><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"566\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/public\" alt=\"\" class=\"wp-image-69260\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=2048,fit=scale-down 2048w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure><p>\n\n\n\n<div class=\"protip\">\n                    <h2 class=\"featured-snippet title\">What Is Interaction to Next Paint (INP)?<\/h2>\n                    <p>Interaction to Next Paint (INP) is a Core Web Vitals metric that measures web page response time. It determines how quickly a web page updates after a user interacts with it, such as by clicking on a link or pressing a button.<\/p>\n                <\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-how-interaction-to-next-paint-inp-works\">How Interaction to Next Paint (INP) Works<\/h3><p>As a responsiveness metric, INP focuses on user interaction delay. It measures how quickly a web page element will respond after you perform a certain action on it.<\/p><p>Here&rsquo;s how INP works:<\/p><ol class=\"wp-block-list\">\n<li>A user interacts with a web page, such as clicking on a button.<\/li>\n\n\n\n<li>The browser sends a request to the web server for the new content.<\/li>\n\n\n\n<li>The web server sends the new content to the browser.<\/li>\n\n\n\n<li>The browser renders the new content on the page.<\/li>\n\n\n\n<li>The browser measures the time it takes to render the new content and reports it as the INP score.<\/li>\n<\/ol><p>A low INP value means the page is highly responsive toward user interaction.<\/p><p>As a part of <a href=\"\/ng\/tutorials\/core-web-vitals\">Core Web Vitals<\/a>, INP is important for the following reasons:<\/p><ul class=\"wp-block-list\">\n<li><strong>Improved user experience. <\/strong>A high INP value means users have to wait a long time for the web page to react to their interactions, which can be frustrating.<\/li>\n\n\n\n<li><a href=\"\/ng\/tutorials\/what-is-seo\/\"><strong>Search engine optimization (SEO)<\/strong><\/a><strong>.<\/strong> INP and other Core Web Vitals are part of Google&rsquo;s <a href=\"https:\/\/developers.google.com\/search\/blog\/2020\/05\/evaluating-page-experience\">page experience signals<\/a>, determining a website&rsquo;s rank on its results pages. This makes the INP SEO metric especially important.<\/li>\n\n\n\n<li><strong>Lower bounce rate. <\/strong>Slow loading time can make users abandon the page, hurting your business&rsquo;s bottom line.<\/li>\n<\/ul><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-full\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-web-hosting\" href=\"\/ng\/web-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/public\" alt=\"Hostinger web hosting banner\" class=\"wp-image-98604\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\" id=\"h-interaction-to-next-pain-inp-as-a-core-web-vital\">Interaction to Next Pain (INP) as a Core Web Vital<\/h3><p>INP <a href=\"https:\/\/web.dev\/blog\/inp-cwv-march-12\">replaced the First Input Delay (FID)<\/a> metric in March, 2025. INP vs FID are similar, but they work differently.<\/p><p><a href=\"\/ng\/tutorials\/first-input-delay\">FID<\/a> measures page load responsiveness only when the website is first opened. On the other hand, Google&rsquo;s INP metric accounts for all user interaction delays throughout an entire visit after the page has loaded.<\/p><p>According to Google&rsquo;s data, most of a user&rsquo;s time spent on a website is after it loads. As such, INP can measure page interactivity much more effectively than FID.<\/p><p>INP also differs from other Core Web Vitals like <a href=\"\/ng\/tutorials\/cumulative-layout-shift-cls\">Cumulative Layout Shift (CLS)<\/a> and <a href=\"\/ng\/tutorials\/largest-contentful-paint\">Large Contentful Paint (LCP)<\/a>. CLS evaluates how much a site can shift unexpectedly, whereas LCP determines how fast a web page displays its largest elements.<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-measure-interaction-to-next-paint-inp\">How to Measure Interaction to Next Paint (INP)<\/h2><p>Before initiating Interaction to Next Paint measurement, let&rsquo;s see what INP values mean.<\/p><p>INP is measured in milliseconds (ms). A <strong>Good<\/strong> benchmark is below 200 ms, and anything between that and 500 ms is seen as <strong>Needs Improvement<\/strong>. 500 ms or higher is considered <strong>Poor<\/strong>.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/08\/how-to-measure-INP.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"406\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/how-to-measure-INP.png\/public\" alt=\"A custom visual showing what counts as a Good, Needs Improvement, and Poor INP scores\" class=\"wp-image-92328\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/how-to-measure-INP.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/how-to-measure-INP.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/how-to-measure-INP.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/how-to-measure-INP.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><p>Various factors can affect an INP value, such as the size and complexity of a web page, as well as the number of JavaScript and CSS files loaded.<\/p><p>You can measure a website&rsquo;s INP value using <a href=\"\/ng\/tutorials\/website-speed-test\/\">website speed testing<\/a> tools. This type of application can provide insights into how your Core Web Vitals metrics are performing and how to optimize for them.<\/p><p><a href=\"https:\/\/pagespeed.web.dev\/\">Google PageSpeed Insights<\/a><strong> <\/strong>is a popular option for measuring INP and website performance. It will audit a site and provide details on what best practices to implement. You can also see your site speed when loaded on mobile and desktop devices.<\/p><p>PageSpeed Insights displays two types of results. The top section shows a site&rsquo;s Core Web Vitals metrics from the <a href=\"https:\/\/developer.chrome.com\/blog\/chrome-ux-report-pagespeed-insights\/\">Chrome UX report<\/a>, a collection of real-world performance data from Chrome users.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-real-field-data.png\"><img loading=\"lazy\" decoding=\"async\" width=\"789\" height=\"632\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-real-field-data.png\/public\" alt=\"A website's real-world performance data on PageSpeed Insights\" class=\"wp-image-92335\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-real-field-data.png\/w=789,fit=scale-down 789w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-real-field-data.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-real-field-data.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-real-field-data.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/a><\/figure><\/div><p>The report below displays the same metrics, but they&rsquo;re from a controlled lab environment running on Google Lighthouse. This data can be useful for testing new features before publishing them live.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-lab-data.png\"><img loading=\"lazy\" decoding=\"async\" width=\"786\" height=\"698\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-lab-data.png\/public\" alt=\"A website's lab site speed data on PageSpeed Insights\" class=\"wp-image-92333\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-lab-data.png\/w=786,fit=scale-down 786w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-lab-data.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-lab-data.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-lab-data.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/a><\/figure><\/div><p>If the site&rsquo;s INP data is unavailable, check its Total Blocking Time (TBT). This metric measures a different type of responsiveness. It focuses on how long a page is blocked from responding to interaction during the page load.<\/p><p>Toward the bottom, there are suggestions on how to improve the Core Web Vitals metrics, like so:<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-opportunities-diagnostics.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1002\" height=\"673\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-opportunities-diagnostics.png\/public\" alt=\"The performance improvement suggestions section on PageSpeed Insights\" class=\"wp-image-92334\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-opportunities-diagnostics.png\/w=1002,fit=scale-down 1002w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-opportunities-diagnostics.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-opportunities-diagnostics.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/pagespeed-insights-opportunities-diagnostics.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1002px) 100vw, 1002px\" \/><\/a><\/figure><\/div><p>Hostinger clients can use the built-in <a href=\"https:\/\/support.hostinger.com\/en\/articles\/6104420-how-to-analyze-your-website-s-speed\">PageSpeed Insights integration<\/a> on hPanel. Open your hosting account dashboard &rarr; <strong>Performance<\/strong> &rarr; <strong>Page Speed<\/strong> to access it.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/08\/hostinger-pagespeed-insights-hpanel.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1174\" height=\"735\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hostinger-pagespeed-insights-hpanel.png\/public\" alt=\"Hostinger's PageSpeed Insights integration on hPanel\" class=\"wp-image-92331\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hostinger-pagespeed-insights-hpanel.png\/w=1174,fit=scale-down 1174w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hostinger-pagespeed-insights-hpanel.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hostinger-pagespeed-insights-hpanel.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hostinger-pagespeed-insights-hpanel.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hostinger-pagespeed-insights-hpanel.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1174px) 100vw, 1174px\" \/><\/a><\/figure><\/div><h2 class=\"wp-block-heading\" id=\"h-how-to-optimize-for-interaction-to-next-paint-inp\">How to Optimize for Interaction to Next Paint (INP)<\/h2><p>Let&rsquo;s discuss how to perform INP optimization on your website.<\/p><p><div><p class=\"important\"><strong>Important!<\/strong> Most of these methods require some technical knowledge of JavaScript. Before making changes on your website, ensure to <a href=\"\/ng\/tutorials\/backups\/downloading-website-backup\">back it up<\/a> in case of errors.<\/p><\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-1-optimize-javascript-execution\">1. Optimize JavaScript Execution<\/h3><p><a href=\"\/ng\/tutorials\/what-is-javascript\">JavaScript is<\/a> a major component of many web pages. It adds various interactive elements but can also slow down site performance.<\/p><p>When executed, JavaScript runs on the main thread &ndash; the one responsible for rendering a web page. If the code is inefficient, it can block the thread and prevent the page from responding to user interaction.<\/p><p>The key to speeding up responsiveness is to optimize your JavaScript, which you can do by:<\/p><ul class=\"wp-block-list\">\n<li><a href=\"\/ng\/tutorials\/website\/improving-website-performance-minifying-css-html-and-javascript\"><strong>Minifying JavaScript files<\/strong><\/a><strong>.<\/strong> It will reduce the JavaScript size, making them load faster.<\/li>\n\n\n\n<li><a href=\"\/ng\/tutorials\/enable-gzip-compression\"><strong>Enabling GZip compression<\/strong><\/a><strong>. <\/strong>Another popular method to make site files and data smaller.<\/li>\n\n\n\n<li><strong>Using a JavaScript framework.<\/strong> This tool can help organize your JavaScript code to make it more efficient. AngularJS and <a href=\"\/ng\/tutorials\/what-is-jquery\/\">jQuery<\/a> are some well-known examples.<\/li>\n\n\n\n<li><a href=\"\/ng\/tutorials\/what-is-cdn\"><strong>Using a CDN<\/strong><\/a><strong>.<\/strong> Short for content delivery network, this feature will deliver your JavaScript files from servers close to your target audience, improving loading times. To use Hostinger&rsquo;s in-house CDN, users should <a href=\"\/ng\/web-hosting\">buy a Business hosting plan<\/a> or higher.<\/li>\n<\/ul><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/08\/hpanel-cdn-page.png\"><img loading=\"lazy\" decoding=\"async\" width=\"895\" height=\"688\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hpanel-cdn-page.png\/public\" alt=\"The CDN page on hPanel, where Hostinger's Business hosting plan clients and higher can manage their CDN settings\" class=\"wp-image-92332\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hpanel-cdn-page.png\/w=895,fit=scale-down 895w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hpanel-cdn-page.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hpanel-cdn-page.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hpanel-cdn-page.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 895px) 100vw, 895px\" \/><\/a><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-2-use-web-workers\">2. Use Web Workers<\/h3><p>Web workers are a service that lets JavaScript run independently off the main thread. They&rsquo;re useful for executing complex operations in the background.<\/p><p>Say you have a WordPress website full of images, videos, and data. Web workers can offload these heavy JavaScript computations to a background thread to prevent freezing your interface.<\/p><p>To use web workers, you will need to create two JavaScript files. One is the <strong>main.js<\/strong> to initiate the web worker script tasks:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ main.js\nif (window.Worker) {\n  \/\/ Create a new worker instance\n  const myWorker = new Worker('worker-script.js');\n  \/\/ Send a message to the worker\n  myWorker.postMessage('Hello Worker!');\n  \/\/ Listen for messages from the worker\n  myWorker.onmessage = function(e) {\n    console.log('Message received from worker', e.data);\n  };\n} else {\n  console.log('Your browser does not support Web Workers.');\n}<\/pre><p>Another is <strong>worker.js<\/strong>, which contains the web worker&rsquo;s tasks. Here&rsquo;s a simplified example:<\/p><pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\/\/ worker.js\nonmessage = function(e) {\n  console.log('Message received from main script', e.data);\n  \/\/ Perform heavy computation or data processing here\n  \/\/ Then send a message back to the main script\n  postMessage('Hello Main Script!');\n}<\/pre><p>To include these scripts in your website, check your specific technology or platform&rsquo;s documentation and follow the standard process.<\/p><p>For WordPress users, use the <strong><a href=\"\/ng\/tutorials\/wp_enqueue_script\">wp_enqueue_script<\/a><\/strong> function to include web worker scripts within your <a href=\"\/ng\/tutorials\/wordpress-theme-editor\/\">theme&rsquo;s functions.php file<\/a>.<\/p><h3 class=\"wp-block-heading\" id=\"h-3-break-up-long-tasks\">3. Break Up Long Tasks<\/h3><p>Breaking up long JavaScript tasks is another way to prevent main thread blocking.<\/p><p>Let&rsquo;s use an example of online shoppers browsing through an eCommerce site. Without breaking up long tasks, the main thread needs to fetch, process, and render large amounts of product data and images simultaneously &ndash; consuming a lot of time and resources.<\/p><p>While this process is happening, the main thread is occupied. This makes the website load slowly and unable to respond to the next user interaction.<\/p><p>Breaking up long tasks allows the web browser to handle smaller chunks at a time. As a result, the main thread is free to perform more essential tasks.<\/p><p>You can use two types of code to separate long tasks:<\/p><ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.freecodecamp.org\/news\/javascript-settimeout-how-to-set-a-timer-in-javascript-or-sleep-for-n-seconds\/\"><strong>setTimeout<\/strong><\/a><strong>.<\/strong> A built-in JavaScript function that schedules a specified task to run after a certain delay in milliseconds. It can defer the execution to a later time, preventing the main thread from being blocked for an extended period.<\/li>\n\n\n\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Window\/requestIdleCallback\"><strong>requestIdleCallback<\/strong><\/a><strong>. <\/strong>This API provides a more efficient approach as it ensures that the functions are executed during periods of idle time. It also offers a deadline parameter, letting you control how much time the task can take without affecting important processes.<\/li>\n<\/ul><h3 class=\"wp-block-heading\" id=\"h-4-prioritize-input-readiness\">4. Prioritize Input Readiness<\/h3><p>Input readiness refers to when a web page is ready to respond to user interaction. When it&rsquo;s not, it usually means the browser&rsquo;s main thread is busy performing other tasks.<\/p><p>Here&rsquo;s how to prioritize input readiness to improve INP:<\/p><ul class=\"wp-block-list\">\n<li><a href=\"\/ng\/tutorials\/wordpress\/how-to-defer-parsing-of-javascript-in-wordpress\"><strong>Deferring non-critical JavaScript<\/strong><\/a><strong>. <\/strong>Some JavaScript is not essential for the initial page load and can be executed after the main content. This allows the main thread to prioritize user interactions and improve overall page responsiveness.<\/li>\n\n\n\n<li><strong>Throttling.<\/strong> This technique controls a function execution&rsquo;s frequency. For instance, when users scroll down, that event can trigger the same code hundreds of times per second. Throttling allows it to only execute once every certain millisecond or so, no matter how many times the event is actually fired.<\/li>\n\n\n\n<li><strong>Debouncing. <\/strong>This prevents a function from running again until some time has passed. For example, when users resize their browser window, this event may trigger the same process repeatedly. Debouncing can delay its execution until the user stops resizing for a specified time.<\/li>\n\n\n\n<li><strong>Passive event listeners. <\/strong>Event listeners are programming constructs that spot specific events, like scrolls and taps. Making them passive will tell the browser not to wait for a certain function to finish executing and continue with other tasks in the meantime.<\/li>\n<\/ul><h3 class=\"wp-block-heading\" id=\"h-5-provide-immediate-feedback\">5. Provide Immediate Feedback<\/h3><p>Some interactions can result in noticeable response delays, like submitting a form with multiple data inputs.<\/p><p>That&rsquo;s where immediate feedback comes in. This tactic gives users a visual indication the website has received and is processing their request.<\/p><p>With immediate feedback, users won&rsquo;t wonder whether the website has registered their input. It can give the impression of faster performance, even if it doesn&rsquo;t reduce the actual processing time.<\/p><p>Check out some examples of immediate feedback cues:<\/p><ul class=\"wp-block-list\">\n<li><strong>Loading indicators.<\/strong> Show a spinner or a progress bar when a process is underway, especially when displaying data or moving to a new page.<\/li>\n\n\n\n<li><strong>Acknowledgment pop-ups.<\/strong> For actions like adding an item to a cart, it&rsquo;s good to display a message that confirms the action was successful.<\/li>\n\n\n\n<li><strong>Form field validation.<\/strong> For example, if a user has input an incorrectly formatted email address, show an error message immediately rather than waiting until they submit the form.<\/li>\n<\/ul><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/08\/hostinger-domain-checker-loading-indicator.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"433\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hostinger-domain-checker-loading-indicator.png\/public\" alt=\"Example of an immediate feedback in the form of a loading indicator on Hostinger's domain checker\" class=\"wp-image-92330\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hostinger-domain-checker-loading-indicator.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hostinger-domain-checker-loading-indicator.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hostinger-domain-checker-loading-indicator.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/08\/hostinger-domain-checker-loading-indicator.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><\/div><h2 class=\"wp-block-heading\" id=\"h-what-interaction-to-next-paint-inp-means-for-site-owners\">What Interaction to Next Paint (INP) Means for Site Owners<\/h2><p>INP and website ranking will have a strong correlation. Failing to optimize it can lead to poor website speed, user experience, and in turn, organic traffic performance.<\/p><p>In fact, <a href=\"https:\/\/web.dev\/economic-times-inp\/\">Economic Times<\/a> has proven that improving INP has significant business benefits. They&rsquo;ve reduced their bounce rate by <strong>50%<\/strong>, meaning visitors are likelier to stay and explore their content.<\/p><p>Identifying what makes your website&rsquo;s responsiveness slow is key to optimizing for INP. Conduct <a href=\"\/ng\/tutorials\/testing-in-production\">production tests<\/a>, examine how your website handles user input, and consult with a web developer if needed.<\/p><p><div class=\"protip\">\n                    <h4 class=\"title\">Discover More Resources to Optimize For INP and User Experience<\/h4>\n                    <p><a href=\"\/ng\/tutorials\/website-optimization\">Website Optimization: Top 10 Strategies to Improve Speed + Tools<\/a><br>\n<a href=\"\/ng\/tutorials\/website-performance\">Everything You Need to Know About Website Performance<\/a><br>\n<a href=\"\/ng\/tutorials\/seo-friendly-website\">How to Create an SEO-Friendly Website<\/a><br>\n<a href=\"\/ng\/tutorials\/mobile-friendly-website\">How to Make a Website Mobile-Friendly<\/a><br>\n<a href=\"\/ng\/tutorials\/web-design-best-practices\">Web Design Best Practices to Attract More Website Visitors<\/a><\/p>\n                <\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>Short for Interaction to Next Paint, INP is a Core Web Vitals metric that replaced FID. It measures the time it takes for a website to respond to user interaction. The lower the score, the faster your site&rsquo;s responsiveness is.<\/p><p>The difference between INP and FID is that the first measures all user interaction delays in an entire session. The second metric focuses on the same element only when the website is first opened.<\/p><p>Use PageSpeed Insights to measure your website&rsquo;s INP. If the data is unavailable, you can also refer to your site&rsquo;s TBT metric.<\/p><p>Optimizing for INP involves several methods &ndash; from making your JavaScript execution more efficient and using web workers to prioritizing input readiness. Regardless of the process, back up your website to anticipate any errors when making changes.<\/p><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-full\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-web-hosting\" href=\"\/ng\/web-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/public\" alt=\"Hostinger web hosting banner\" class=\"wp-image-98604\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-interaction-to-next-paint-inp-faq\">Interaction to Next Paint (INP) FAQ<\/h2><p>Check out answers to frequently asked questions about the INP Google ranking factor.<\/p><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1692872439904\"><h3 class=\"schema-faq-question\">Is INP a Core Web Vitals Metric?<\/h3> <p class=\"schema-faq-answer\">Yes, INP is a Core Web Vitals metric that replaced FID for measuring responsiveness in March 2025.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1692872448919\"><h3 class=\"schema-faq-question\">What is a Good INP Score?<\/h3> <p class=\"schema-faq-answer\">A good INP score is below 200 ms. A value between 200 and 500 ms is considered as <strong>Needs improvement,<\/strong> and anywhere above 500 ms is <strong>Poor<\/strong>.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1692872456408\"><h3 class=\"schema-faq-question\">What Is the Difference Between INP and First Input Delay?<\/h3> <p class=\"schema-faq-answer\">FID measures a web page&rsquo;s time to respond to the first user input, while INP assesses the response time to any interaction by the website visitor &ndash; not just the first one. This makes INP a more comprehensive responsiveness metric.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1692872471206\"><h3 class=\"schema-faq-question\">How to Identify INP Problems on Your Website?<\/h3> <p class=\"schema-faq-answer\">Use PageSpeed Insights to get your website&rsquo;s INP score and suggestions for improving its performance.<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>Interaction to Next Paint (INP) is one of the performance metrics Google has introduced to measure web pages&rsquo; responsiveness. If you want to improve your site&rsquo;s search engine rankings, understanding what is INP and how to optimize for it is crucial. Otherwise, your pages may rank lower in search results. This article will look into [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ng\/tutorials\/interaction-to-next-paint\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":140,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"What Is Interaction to Next Paint (INP) + Optimization Tips","rank_math_description":"Interaction to Next Paint (INP) is a Core Web Vital metric that will replace FID in March 2025. Check this article to learn more about it.","rank_math_focus_keyword":"inp","footnotes":""},"categories":[22619],"tags":[],"class_list":["post-92324","post","type-post","status-publish","format-standard","hentry","category-seo"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/interaction-to-next-paint","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/interaction-to-next-paint","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/interaction-to-next-paint","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/interaction-to-next-paint","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/interaction-to-next-paint","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/interaction-to-next-paint","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/interaction-to-next-paint","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/interaction-to-next-paint","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/interaction-to-next-paint","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/interaction-to-next-paint","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/interaction-to-next-paint","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/interaction-to-next-paint","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/interaction-to-next-paint","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/interaction-to-next-paint","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/92324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/140"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=92324"}],"version-history":[{"count":11,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/92324\/revisions"}],"predecessor-version":[{"id":143995,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/92324\/revisions\/143995"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=92324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=92324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=92324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}