Interaction to Next Paint (INP)

What is Interaction to Next Paint (INP) and How to Improve it?

Ashkar Gomez
11min read
Table of Contents

The Web Performance metrics are more important than ever in today’s digital environment. This is because the user experience has the power to create or ruin the online presence.

Among these metrics, one of the important measurements to assess the website’s responsiveness is Interaction to Next Paint (INP). 

INP is a vital component of Google’s Core Web Vitals. It helps to provide flawless and fulfilling user experience. This results in a direct impact on the SEO performance of the website.

In this article, let us explore what is INP and how to improve it in detail.

What is Interaction to Next Paint (INP)?

Interaction to Next Paint (INP) is a performance metric that measures the time from when a user interacts with the website until the browser displays the subsequent visual change.

In simpler terms, it measures how quickly the website responds to user inputs such as clicking a button or submitting a form.

Thus INP is an important metric since it captures the actual user experience when they interact with the website. In contrast to other metrics which measure the initial loading times, INP stays focused on the ongoing interaction between the user and the page. 

It provides a clear understanding of a website’s responsiveness during user engagement.

How is INP Calculated?

The INP is calculated by measuring the interval between user’s input and the next visual update on the page.

This also includes any changes triggered by CSS updates, JavaScript execution and other rendering processes.

The steps involved in the calculation of INP is as follows,

Step 1 – When a user performs an action like clicking a button, selecting a menu item or typing in a form, the metric begins.

Step 2 – The browser handles the interaction. It involves the execution of JavaScript to handle the event.

Step 3 – The user’s action is reflected on the screen. Now the browser renders the next frame.

Step 4 – The time elapsed between the user interaction and the next paint is recorded as INP.

When the INP is lower, the website appears more responsive to the users.

What is Considered a Good INP Score?

The target values of INP is as follows,

  • Good – INP values at or below 200 ms. This indicates the page has good responsiveness.
  • Needs Improvement – INP values between 200 and 500 ms indicate that the page needs improvement.
  • Poor – INP values above 500 ms are considered poor. It negatively impacts the user experience.
Interaction to Next Paint (INP) Values

How to improve Interaction to Next Paint (INP)?

The INP can be improved by the combination of technical optimizations. It aims to reduce the time taken by the website to respond to user interactions.

Some of the effective strategies are as follows,

1.Optimize JavaScript Execution

Defer and Async Attributes – JavaScript tasks that are long running block the main thread. This delays the rendering of the next frame. Hence to prevent blocking, break lengthy scripts into smaller and  asynchronous tasks.

The modern features like asynchronous loading helps in this case. It minimizes the load on the main thread by handling when and how JavaScript should be executed.

How to Implement: It involves two attributes Defer and Async.

“defer” attribute:

  • Use this for scripts that don’t need to run immediately. 
  • While the script is downloading, it allows the HTML parsing to continue.
  • The script will only run after the HTML is fully parsed.
<script src="script.js" defer></script>

“async” attribute:

  • Use this for scripts that can run independently of other scripts.
  • This allows the script to be downloaded in parallel with the HTML Parsing.
  • It will execute as soon as the script is ready.
<script src="analytics.js" async></script>

Code Splitting – For the initial interaction load only the necessary JavaScript. This can be done by implementing Code Splitting.

Break the JavaScript code into smaller portions. It should only be loaded when needed. This process can also be automated with the help of tools like Webpack.

Lazy Loading – Make use of Lazy loading to delay the use of non-essential resources until they are required.

2.Reduce Input Latency

The input handlers like onClick or onSubmit should be lightweight and efficient. When processing user inputs, avoid performing unnecessary computations.

There are three stages involved in the user interaction. They are,

  • Input Delay – This starts when a user starts an interaction and ends when the interaction’s event callback begins to function.
  • The Processing time – The amount of time needed for the event callbacks to complete.
  • Presentation Delay –  The amount of time it takes for the browser to update the next frame with visual feedback.

Long tasks which take over 50 ms cause significant delays in processing the user interactions.  So break it into smaller portions.

Use “setTimeout” or “requestIdleCallback” to execute each portion. This helps the browser to handle user interactions between tasks.

For example: Use the “requestIdleCallback” method to perform less critical tasks during the idle time when the main thread is not busy. This prioritizes user interactions.

requestIdleCallback(() => {

    // Perform non-urgent tasks

    // Example: Loading analytics, lazy loading images

});

3.Optimize Rendering and Paint Performance

Visual updates following an interaction may be delayed by inefficient rendering or paint processes.

Consider a web page having a dynamic content section that updates frequently. Excessive DOM changes can cause multiple reflows and repaints on the webpage. This increases the INP.

To improve the INP score of the website, these changes should be consolidated and DOM should be updated once per interaction.

How to Overcome:

  • Avoid unnecessary DOM manipulations to minimize layout shifts and repaints. Combine DOM changes together.
// Instead of:

element.style.width = '100px';
element.style.height = '100px';

// Do:

element.style.cssText = 'width: 100px; height: 100px;';
  • Use techniques like “will-change” to optimize for specific animations or transitions.

“will – change” property: Informs the browser which elements are going to change. So, it can optimize rendering in advance.

.animated-element {
   will-change: transform, opacity;
}
  • Well optimize the CSS and Animations. This will reduce the time the browser takes to render updates.

4.Use a Content Delivery Network (CDN)

Slow server response time delays the delivery of the content. It affects the INP.

How to Overcome:

  • Choose a CDN provider like Cloudflare, AWS CloudFront. 
  • Configure it to cache and deliver the static assets like JavaScript, CSS and Images from edge servers around the world.
  • The CDN reduces latency and speeds up the time it takes for a user to receive content after interaction. Thus it helps to distribute the content close to the users.

For Example, A global e-commerce site notices that the users in distinct regions experience slower interaction times.

The site implements CDN. Thus it reduces the time it takes for the server to respond to user interactions. This leads to lower INP.

Improving the Time To First Byte (TTFB) also helps to speed up the overall response time. This leads to quicker interaction response

5.Make Critical Resources a Priority

The third party scripts or ads which are non critical resources block the main thread. This delays the INP.

How to Overcome:

  • Load critical resources first.
  • Defer the non-essential resources until after the main content has been rendered.
  • Use “resource hints” like “preload”, “prefetch”, or “preconnect” to make sure that the critical resources are available as soon as needed.

For Example, A news website has a number of ads and analytics scripts that load before the main content .

The site prioritizes the loading of the main article text and images and defer these scripts. Thus the site ensures that the users see the content faster after an interaction. This improves the INP.

6.Monitor and Measure INP

The INP can be measured with the help of tools like,

  • Lighthouse
  • Chrome Dev Tools
  • Web Vitals.

The INP score of the website should be regularly monitored. Identify areas where improvements can be made.

For INP and other Core Web Vitals, create performance budgets. By setting and adhering to these budgets, the website remains responsive.

Conclusion

In Conclusion, this article reveals what is INP and how to improve it. In short, it is a vital metric to assess and improve the website’s responsiveness.

Optimizing INP enhances user experience and boosts SEO performance of the website. This leads to better rankings and increased traffic.

In the end,  keep in mind that having a responsive website is needed to keep the users engaged and satisfied.

For a holistic approach to improve your website’s performance and search engine visibility, explore our Technical SEO Services.

Frequently Asked Questions (FAQs)

How does INP differ from FID?

The First Input Delay (FID) refers to the time interval between a user’s initial interaction with a page and the browser’s ability to start processing event handlers. It is concerned with the time it takes for processing to begin.

The Interaction to Next Paint (INP) measures the interval between a user interaction and the subsequent visual update on the screen. INP captures the end-to-end interaction experience by concentrating on overall responsiveness.

What is considered a Good INP Score?

A good INP score is considered to be less than 200 milliseconds. Scores between 200-500 milliseconds are acceptable. But it needs improvement.

If the time exceeds 500 milliseconds, there is a noticeable delay on your website. This has a negative impact on SEO and user experience.

What are the common causes of poor INP?

The common causes of poor INP includes,

  • Long running JavaScript
  • Heavy CSS and frequent Layout Shifts
  • Scripts from External Sources
  • Delays in Server Responses
Picture of Ashkar Gomez

Ashkar Gomez

Ashkar Gomez is the Founder of 7 Eagles (a Growth Marketing & SEO Company). Ashkar started his career as a Sales Rep in 2013 and later shifted his career to SEO in 2014. He is one of the leading SEO experts in the industry with 8+ years of experience. He has worked on 200+ projects across 20+ industries in the United States, Canada, the United Kingdom, UAE, Australia, South Africa, and India. Besides SEO and Digital Marketing, he is passionate about Data Analytics, Personal Financial Planning, and Content Writing.

Table of Contents

Related Articles

Your Business
Growth
Starts Here

Let’s Have a Cup of Digital Tea

Request Your Free Quote

Book Your Free Marketing Consultation

Your Monthly ads spend
Convenient Time To Call