{"id":50246,"date":"2022-03-31T16:01:02","date_gmt":"2022-03-31T16:01:02","guid":{"rendered":"\/tutorials\/?p=50246"},"modified":"2025-04-28T07:40:36","modified_gmt":"2025-04-28T07:40:36","slug":"first-input-delay","status":"publish","type":"post","link":"\/in\/tutorials\/first-input-delay","title":{"rendered":"What Is First Input Delay and How to Improve It"},"content":{"rendered":"<p>The First Input Delay (FID), also known as input latency, calculates a website&rsquo;s response time from the first user interaction to the browser&rsquo;s response.<\/p><p>Scrolling and zooming cannot be measured with the first input delay as they are classified as animation aspects in the RAIL model. FID focuses solely on the responsiveness of a website, measuring the delay in processing user requests.<\/p><p>Analyzing the input delay is essential as it affects your website&rsquo;s user experience. Even 25% of visitors will leave a website if it takes more than 4 seconds to load.<\/p><p>In this article, we will go over the first input delay, from its definition, importance, and optimization to its relation to other Core Web Vitals metrics. We&rsquo;ll also explain how to test your FID score and why it might be low.<\/p><figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Build-WordPress-Website-in-9%20Steps.pdf\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"283\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1-1024x283.png\" alt=\"\" class=\"wp-image-69276\" style=\"width:840px;height:auto\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1-1536x425.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1-300x83.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1-150x41.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1-768x212.png 768w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/11\/eBook_-Build-website-in-9-steps_in-text-banner-1.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><p>\n\n\n\n\n\n<div class=\"protip\">\n                    <h2 class=\"featured-snippet title\">What Is First Input Delay (FID)?<\/h2>\n                    <p> The First Input Delay is a metric used to track the delay time of the browser until it responds to user input, including clicks and taps. <\/p>\n                <\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-why-is-first-input-delay-important\">Why Is First Input Delay Important?<\/h2><p>One of the factors that can affect the impression of a website is the first input delay. It is of the Core Web Vitals metrics, along with the Largest Contentful Paint (LCP), Cumulative Layout Shift (CSL), and the Interaction to Next Paint (INP).<\/p><p>With Core Web Vitals, you can measure your page performance as well as investigate a provided report to help you improve your site and put it on the <a href=\"\/in\/tutorials\/how-can-i-get-to-the-top-of-search-pages\">top of the search engines<\/a>.<\/p><p>Furthermore, those metrics impact user experience and a website&rsquo;s ranking, affecting your search engine optimization (SEO) efforts. <a href=\"https:\/\/www.searchenginejournal.com\/ranking-factors\/page-speed\/\" target=\"_blank\" rel=\"noopener\">Page speed<\/a> is one of the main Google ranking factors.<\/p><p>If the website takes a long time to respond to a user&rsquo;s interactions, it will also make users frustrated.<\/p><p>As most responsiveness issues occur when a web page is loading, keeping the first input delay score low is vital.<\/p><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Suggested Reading<\/h4>\n                    <p> Read our detailed tutorial on 10 effective strategies to <a href=\"\/in\/tutorials\/how-to-improve-core-web-vitals\">improve your Core Web Vitals<\/a>.<\/p>\n                <\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-test-your-first-input-delay\">How to Test Your First Input Delay<\/h2><p>Having gone over why the first input delay is important for your page, it is time to test it to improve your website performance for better user interaction.<\/p><p>Unlike the cumulative layout shift and the largest contentful paint, the first input delay can only be measured with real user interaction on the page.<\/p><p>Here&rsquo;s the list of tools you can use to test your first input delay:<\/p><ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/GoogleChrome\/web-vitals\" target=\"_blank\" rel=\"noopener\"><strong>Web Vitals JavaScript Library<\/strong><\/a><strong> <\/strong>&ndash;<strong> <\/strong>built for front-end monitoring, the tool helps analyze every metric in a short time with high accuracy. Each metric defines as a single function, the <strong>onReport<\/strong> callback. After configuring your web-vitals library, the tool will report whether your pages have reached the recommended threshold.<\/li>\n\n\n\n<li><a href=\"https:\/\/developers.google.com\/web\/tools\/chrome-user-experience-report\" target=\"_blank\" rel=\"noopener\"><strong>Chrome User Experience Report<\/strong><\/a><strong> <\/strong>&ndash; also known as <strong>CrUX<\/strong>, this tool helps developers improve website usability with the Core Web Vitals and diagnostic metrics based on real user data. CrUX is supported by the standard web platform APIs, which means you can use the same APIs to collect the <a href=\"https:\/\/stackify.com\/what-is-real-user-monitoring\/\" target=\"_blank\" rel=\"noopener\">Real User Monitoring<\/a> (RUM) data.<\/li>\n<\/ul><ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/support.google.com\/webmasters\/answer\/9205520\" target=\"_blank\" rel=\"noopener\"><strong>Search Console Core Web Vitals Report<\/strong><\/a><strong> <\/strong>&ndash; helps web developers fix poor user experience. It evaluates your website&rsquo;s performance based on field data over 90 days by URL status, group, and metric type. Note that the report is only for indexed URLs and is based on Web Core Vitals. Thus, if a URL does not have sufficient information for any of the metrics, it will be omitted from the report.<\/li>\n\n\n\n<li><a href=\"https:\/\/pagespeed.web.dev\/\" target=\"_blank\" rel=\"noopener\"><strong>Page Speed Insights<\/strong><\/a><strong> <\/strong>&ndash;<strong> <\/strong>quickly checks the latest website performance. It divides the information into desktop and mobile users and data to fix user experience and debugging issues.<\/li>\n<\/ul><p>For example, if you want to use PageSpeed Insights to test your first input delay, just enter one URL in the search box. Having done so, you will get an assessment of Core Web Vitals on your page and suggestions to improve your page. You can also see how long the input delay is on your web page.<\/p><figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/03\/core-web-vitals-desktop-1.png\"><img decoding=\"async\" width=\"1024\" height=\"627\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2024\/03\/core-web-vitals-desktop-1-1024x627.png\" alt=\"An example of the Core Web Vitals assessment showing various metrics, including the First Input Delay\" class=\"wp-image-106842\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/03\/core-web-vitals-desktop-1.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/03\/core-web-vitals-desktop-1-300x184.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/03\/core-web-vitals-desktop-1-150x92.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2024\/03\/core-web-vitals-desktop-1-768x470.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\" id=\"h-what-is-a-good-fid-score\">What Is a Good FID Score?<\/h3><p>Generally, 0.1 seconds is the limit for having the user feel that the system is reacting instantaneously.<\/p><p>As a result, to get a good score from the first input delay and fast user input, a website needs an FID of less than <strong>100 ms<\/strong> as the maximum. Ideally, it should have less than <strong>100 ms<\/strong> from <strong>75%<\/strong> of all page loads, including mobile and desktop devices.<\/p><p>The graph below shows how the first input delay score is categorized into good, needs improvement, and poor.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/03\/screenshot-of-first-input-delay-score-up-to-100-ms-is-good-up-to-300-ms-needs-improvement-and-more-than-300-ms-is-poor..jpg\"><img decoding=\"async\" width=\"1000\" height=\"356\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/03\/screenshot-of-first-input-delay-score-up-to-100-ms-is-good-up-to-300-ms-needs-improvement-and-more-than-300-ms-is-poor..jpg\" alt=\"First input delay score: up to 100 ms is good, up to 300 ms needs improvement, and more than 300 ms is poor. \" class=\"wp-image-50251\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/03\/screenshot-of-first-input-delay-score-up-to-100-ms-is-good-up-to-300-ms-needs-improvement-and-more-than-300-ms-is-poor..jpg 1000w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/03\/screenshot-of-first-input-delay-score-up-to-100-ms-is-good-up-to-300-ms-needs-improvement-and-more-than-300-ms-is-poor.-300x107.jpg 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/03\/screenshot-of-first-input-delay-score-up-to-100-ms-is-good-up-to-300-ms-needs-improvement-and-more-than-300-ms-is-poor.-150x53.jpg 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/03\/screenshot-of-first-input-delay-score-up-to-100-ms-is-good-up-to-300-ms-needs-improvement-and-more-than-300-ms-is-poor.-768x273.jpg 768w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/a><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-max-potential-first-input-delay\">Max Potential First Input Delay<\/h3><p>The Max Potential First Input Delay (MPFID) is the longest task of a page. The MPFID measures a page&rsquo;s response time while the longest task is running. Note that the measurement starts only after the first contentful paint is calculated.<\/p><p>The score results are taken from the comparison of the max potential FID time with the max potential FID times in real websites. For example, if you get your MPFID a green score, it means that your page performs better than <strong>90%<\/strong> of real websites.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/03\/screenshot-of-max-potential-FID-time-in-milliseconds-0-100-is-fast-100-300-is-moderate-over-300-is-slow.jpg\"><img decoding=\"async\" width=\"1000\" height=\"464\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/03\/screenshot-of-max-potential-FID-time-in-milliseconds-0-100-is-fast-100-300-is-moderate-over-300-is-slow.jpg\" alt=\"Max potential FID time (in milliseconds): 0-100 is fast, 100-300 is moderate, over 300 is slow\" class=\"wp-image-50252\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/03\/screenshot-of-max-potential-FID-time-in-milliseconds-0-100-is-fast-100-300-is-moderate-over-300-is-slow.jpg 1000w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/03\/screenshot-of-max-potential-FID-time-in-milliseconds-0-100-is-fast-100-300-is-moderate-over-300-is-slow-300x139.jpg 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/03\/screenshot-of-max-potential-FID-time-in-milliseconds-0-100-is-fast-100-300-is-moderate-over-300-is-slow-150x70.jpg 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2022\/03\/screenshot-of-max-potential-FID-time-in-milliseconds-0-100-is-fast-100-300-is-moderate-over-300-is-slow-768x356.jpg 768w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/a><\/figure><\/div><h2 class=\"wp-block-heading\" id=\"h-how-to-find-the-cause-of-a-low-fid-score\">How to Find the Cause of a Low FID Score<\/h2><p>When you get a low first input delay score, identify which parts of the page need improvement to make your page work better.<\/p><p>One of the leading causes that make browsers unable to respond to user interactions promptly is user input getting blocked. It occurs when the browser&rsquo;s main thread is busy doing other tasks.<\/p><p>These tasks usually include dealing with HTML, CSS, and Javascript, making them overworked. A long JavaScript task is a common error that causes the main thread to delay, and event listeners can&rsquo;t run on the page. To find this problem, use PageSpeed &#8203;&#8203;Insights and look under the <strong>Avoid long main-thread tasks<\/strong> audit section.<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"\/in\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/03\/screenshot-of-PageSpeed-%E2%80%8B%E2%80%8BInsights-with-the-avoid-long-main-thread-tasks-option..png\"><img decoding=\"async\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2022\/03\/screenshot-of-PageSpeed-%E2%80%8B%E2%80%8BInsights-with-the-avoid-long-main-thread-tasks-option.-1024x482.png\" alt='PageSpeed &#8203;&#8203;Insights scressnshots with \"avoid long main-thread tasks\" highlighted' class=\"wp-image-50253\"><\/a><\/figure><\/div><h2 class=\"wp-block-heading\" id=\"h-8-ways-to-optimize-your-first-input-delay-fid\">8 Ways to Optimize Your First Input Delay (FID)<\/h2><p>After learning how to test your FID score and finding out any potential causes, it is time to optimize it.<\/p><p>Usually, JavaScript has the most significant impact on your FID score. For that reason, it is essential to optimize your JavaScript code.<\/p><p>Follow the suggestions below to do so:<\/p><h3 class=\"wp-block-heading\" id=\"h-1-divide-long-tasks-into-smaller-ones\">1. Divide Long Tasks Into Smaller Ones<\/h3><p><strong>Difficulty level: <\/strong>easy<\/p><p><strong>Impact: <\/strong>high<\/p><p>When the browser&rsquo;s main thread is busy and blocked, user requests cannot be processed. This makes the page unresponsive. The inadequate responsiveness is caused by a task running longer than <strong>50 ms<\/strong>.<\/p><p>JavaScript tasks consume lots of resources that can affect your <a href=\"\/in\/tutorials\/website-speed-test\/\">website speed performance<\/a>. To solve this problem, remove them or divide long tasks into smaller, asynchronous ones. At least, one task should take under <strong>50 ms<\/strong>.<\/p><p>You can use the <strong>setTimeout<\/strong> function to break long tasks into smaller tasks as it will make the main thread respond to user inputs without delay.<\/p><h3 class=\"wp-block-heading\" id=\"h-2-implement-progressive-loading\">2. Implement Progressive Loading<\/h3><p><strong>Difficulty level: <\/strong>medium<\/p><p><strong>Impact: <\/strong>high<\/p><p>Having a fast-loading website can improve its user experience. Many components, such as large images or JavaScript tasks, slow web browsers down.<\/p><p>To solve this issue, create progressive loading code by bundling all your JavaScript files into <strong>bundle.js<\/strong>. For this, you can use a <a href=\"https:\/\/webpack.js.org\/\" target=\"_blank\" rel=\"noopener\">webpack<\/a>.<\/p><p>Bundling also helps you minimize the page size and remove unused code or more easily minify it. Moreover, it makes the browser only load UI components when required.<\/p><h3 class=\"wp-block-heading\" id=\"h-3-move-logic-to-server-side\">3. Move Logic to Server-Side<\/h3><p><strong>Difficulty level: <\/strong>hard<\/p><p><strong>Impact: <\/strong>high<\/p><p>Server-side <a href=\"\/in\/tutorials\/what-is-rendering\">rendering<\/a> (SSR) refers to displaying web pages on the server.<\/p><p>With the server-side render, your page is displayed quickly without waiting for resources to become available. It can solve indexed pages and crawl budget issues, benefiting your <a href=\"\/in\/tutorials\/what-is-seo\/\">SEO<\/a>.<\/p><p>Moreover, server-side rendering can increase the speed of the first contentful paint and time to interactive (TTI) by avoiding sending large JavaScript files to the client. As a result, your web page load will run faster.<\/p><p>You can render the server-side version using front-end frameworks like <strong>Vue<\/strong>, <a href=\"\/in\/tutorials\/what-is-react\">React<\/a>, or <strong>Svelte<\/strong>. Before using those applications, make sure you have installed <a href=\"\/in\/tutorials\/what-is-node-js\">Node.js<\/a> to run JavaScript on the server.<\/p><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-full\"><a href=\"\/in\/web-hosting\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/11\/Web-hosting_in-text-banner.png\" alt=\"Hostinger web hosting banner\" class=\"wp-image-98604\" srcset=\"https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/11\/Web-hosting_in-text-banner.png 1024w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/11\/Web-hosting_in-text-banner-300x88.png 300w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/11\/Web-hosting_in-text-banner-150x44.png 150w, https:\/\/www.hostinger.com\/in\/tutorials\/wp-content\/uploads\/sites\/52\/2023\/11\/Web-hosting_in-text-banner-768x225.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h3 class=\"wp-block-heading\" id=\"h-4-generate-content-statically\">4. Generate Content Statically<\/h3><p><strong>Difficulty level: <\/strong>medium<\/p><p><strong>Impact: <\/strong>high<\/p><p>Unlike server rendering, static rendering generates a single HTML page prepared once at build time. It helps the user access the page ahead of time.<\/p><p>You can use a static site generator, like Gatsby, to create static HTML pages from data, content, and templates. Then, it will generate a view of a page that can be served to the users.<\/p><p>Note that static rendering is not suitable for large sites that contain many pages or require response changes on every request. By generating all of your content, the site needs to be deployed and tested, affecting real-time updates. Moreover, your deployment could become impractical.<\/p><h3 class=\"wp-block-heading\" id=\"h-5-review-third-party-script-execution\">5. Review Third-Party Script Execution<\/h3><p><strong>Difficulty level: <\/strong>hard<\/p><p><strong>Impact: <\/strong>high<\/p><p>A slow page loading time can be caused by a third-party script that adds functionality to websites, such as live chat, ads, and analytics. Third-party code can cause problems, like processing too many network requests to different servers sending large JavaScript tasks or images files that block the main thread.<\/p><p>To review your third-party scripts, you can test your site on PageSpeed &#8203;&#8203;Insights. It will show you lists of the loaded third-party resource, along with the transfer size and the main thread blocking time.<\/p><p>Use async or defer attributes to improve your loading times in the third-party scripts. Doing so will help you eliminate the rendering blocking issue and trigger a faster web page loading process. Important scripts that are vital to the page load should not use async or defer attributes as it is only for external scripts.<\/p><h3 class=\"wp-block-heading\" id=\"h-6-utilize-web-workers\">6. Utilize Web Workers<\/h3><p><strong>Difficulty level: <\/strong>hard<\/p><p><strong>Impact: <\/strong>high<\/p><p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Web_Workers_API\/Using_web_workers\" target=\"_blank\" rel=\"noopener\">Web workers<\/a> help reduce the main thread blocking time and improve the FID score of your site. They allow you to put long tasks on the background thread without interfering with the user interface, making your website more responsive.<\/p><p>Use the <strong>Worker(&ldquo;path\/to\/worker\/script&rdquo;)<\/strong> code to create a worker. It can send messages to the JavaScript code by posting messages to an event handler specified by that code and vice versa. Additionally, a web worker can perform input or output tasks using the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/XMLHttpRequest\" target=\"_blank\" rel=\"noopener\">XMLHttpRequest<\/a> or a <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Fetch_API\" target=\"_blank\" rel=\"noopener\">fetch<\/a>.<\/p><p>To help you use a web worker, check out the following libraries:<\/p><ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/github.com\/GoogleChromeLabs\/comlink\" target=\"_blank\" rel=\"noopener\">Comlink<\/a> &ndash; a tiny library that simplifies the use of <strong>postMessage\/<\/strong>.<\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/WebReflection\/workway\" target=\"_blank\" rel=\"noopener\">Workway<\/a> &ndash; a web worker exporter.<\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/developit\/workerize\" target=\"_blank\" rel=\"noopener\">Workerize<\/a> &ndash; a webpack loader that moves a module into a web worker.<\/li>\n<\/ul><h3 class=\"wp-block-heading\" id=\"h-7-optimize-unused-and-non-critical-javascript\">7. Optimize Unused and Non-Critical JavaScript<\/h3><p><strong>Difficulty level: <\/strong>hard<\/p><p><strong>Impact: <\/strong>high<\/p><p>Too many JavaScript tasks will take a lot of time to be parsed and executed. As a result, the browser&rsquo;s response time will be delayed. The browser will pause when it finds a script tag that links to the external JavaScript code. That&rsquo;s why it&rsquo;s important to run only the needed code.<\/p><p>There are some options to optimize JavaScript, such as code-split and defer any non-critical JavaScript. Before that, you can use the <a href=\"https:\/\/developers.google.com\/web\/tools\/chrome-devtools\/coverage\" target=\"_blank\" rel=\"noopener\">Coverage<\/a> tab in Chrome DevTools to see how much unused JavaScript is on your web page.<\/p><p>Code-splitting allows you to split a JavaScript bundle into chunks and help your page load only when needed. This is also known as <a href=\"\/in\/tutorials\/wordpress-lazy-load\">lazy loading<\/a>. Meanwhile, to defer any non-critical Javascript task, always use <a href=\"https:\/\/javascript.info\/script-async-defer\" target=\"_blank\" rel=\"noopener\">async or defer<\/a> for scripts that are not vital for the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/Performance\/Critical_rendering_path\" target=\"_blank\" rel=\"noopener\">critical rendering path<\/a> or <a href=\"https:\/\/www.optimizely.com\/optimization-glossary\/above-the-fold\/\" target=\"_blank\" rel=\"noopener\">above the fold<\/a>.<\/p><h3 class=\"wp-block-heading\" id=\"h-8-revise-polyfills-usage\">8. Revise Polyfills Usage<\/h3><p><strong>Difficulty level: <\/strong>hard<\/p><p><strong>Impact: <\/strong>low<\/p><p>Polyfill is code used to provide modern features on older browsers that do not natively support it. For example, when using modern JavaScript syntax and browser APIs to create code, you will need to transpile it and deliver polyfills so that the modern features will run in older browsers.<\/p><p>The usage of polyfills will create more bundles that will take a longer time to load for the browser. Therefore, it is essential to minimize the unused polyfills and only use them when needed.<\/p><p>To cut down the load time needed for your web page, you can use a JavaScript compiler, such as Babel, and use <a href=\"https:\/\/babeljs.io\/docs\/en\/babel-preset-env\" target=\"_blank\" rel=\"noopener\">@babel\/preset-env<\/a> to include the required polyfills for older browsers. You can also cut down unused polyfills by enabling the bugfixes option for Babel 7.9.<\/p><p>Alternatively, deliver two separate bundles using <a href=\"https:\/\/3perf.com\/blog\/polyfills\/#modulenomodule\" target=\"_blank\" rel=\"noopener\">module\/nomodule<\/a> to optimize polyfills.<\/p><h2 class=\"wp-block-heading\" id=\"h-first-input-delay-in-relation-to-other-metrics\">First Input Delay in Relation to Other Metrics<\/h2><p>The First Input Delay (FID) is a metric that must be tested with a data field based on real user interaction. Additionally, you should monitor other metrics that correlate with FID.<\/p><p>Let&rsquo;s analyze in detail how the other metrics relate to FID scores.<\/p><h3 class=\"wp-block-heading\" id=\"h-first-input-delay-vs-first-contentful-paint-fcp\">First Input Delay vs. First Contentful Paint (FCP)<\/h3><p>The first contentful paint measures how long it takes to load on a page from initial loading until the content is displayed on the screen. The page content comes from the Document Object Model (DOM), including images, text, or charts.<\/p><p>Meanwhile, the first input delay measures how long it takes for a browser to respond. These two things significantly affect the user&rsquo;s first impression before and after interacting with the page. FID and FCP have a solid correlation to give users a better first impression.<\/p><p>In addition, a fast FCP helps users be aware that the information they request is being processed, making them stay on the site.<\/p><h3 class=\"wp-block-heading\" id=\"h-first-input-delay-vs-time-to-interactive-tti\">First Input Delay vs. Time to Interactive (TTI)<\/h3><p>Time to Interactive (TTI) measures how long it takes for a page to become fully interactive. The measurement starts after the FCP is performed when the user can interact on the page.<\/p><p>A fully interactive page means a page responds to user interaction in less than <strong>50 ms<\/strong>, and event handlers are registered for the majority of visible page elements.<\/p><p>By knowing your TTI, you can identify whether your website pages are entirely usable. Along with good FID, your pages can be fully interactive as the user needs.<\/p><h3 class=\"wp-block-heading\" id=\"h-first-input-delay-vs-total-blocking-time-tbt\">First Input Delay vs Total Blocking Time (TBT)<\/h3><p>Total Blocking Time (TBT) and FID are pretty similar. They both measure how long the response time on the page is. The difference is TBT does not use user input. In short, TBT is the amount of time during which long tasks block the main thread.<\/p><p>Long Javascript tasks on web pages can affect FID and TBT assessments. By looking at the FID and TBT metrics, you can see how significant the impact of long tasks is on the site&rsquo;s responsiveness.<\/p><p>These two metrics create a strong correlation and influence each other in the usability of a page. Therefore, increasing your TBT score can be used to optimize your FID.<\/p><p>\n\n\n<div class=\"protip\">\n                    <h4 class=\"title\">Learn More About Other Core Web Vitals<\/h4>\n                    <p><a href=\"\/in\/tutorials\/largest-contentful-paint\">Largest Contentful Paint (LCP): What It Is and 11 Ways to Improve It <\/a><br>\n<a href=\"\/in\/tutorials\/cumulative-layout-shift-cls\">Cumulative Layout Shift (CLS): What It Is and How to Improve It<\/a><br>\n<a href=\"\/in\/tutorials\/interaction-to-next-paint\">INP: Understanding the New Core Web Vitals Metric and How to Optimize for It<\/a><\/p>\n                <\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>Having a responsive website significantly impacts your website&rsquo;s user experience. That&rsquo;s why testing and analyzing core web vitals is essential, including the first input delay (FID). By doing so, you can improve the performance of your website pages.<\/p><p>The most common issue that causes long input delays is a blocked main thread. It is usually caused by unoptimized JavaScript. Therefore, to improve the first input delay score, optimize your JavaScript code by:<\/p><ul class=\"wp-block-list\">\n<li>Breaking up long tasks.<\/li>\n\n\n\n<li>Implementing progressive loading.<\/li>\n\n\n\n<li>Using server-side rendering.<\/li>\n\n\n\n<li>Generating content statically.<\/li>\n\n\n\n<li>Auditing third-party scripts.<\/li>\n\n\n\n<li>Using web workers.<\/li>\n\n\n\n<li>Deferring unused and non-critical JavaScript.<\/li>\n\n\n\n<li>Restricting polyfills usage.<\/li>\n<\/ul><p>After you modify a page, test your browser and ensure that the <a href=\"\/in\/tutorials\/website-optimization\">website is optimized<\/a> and working properly. If you have any questions or thoughts about improving your first input delay score, do not hesitate to share them in the comments section below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The First Input Delay (FID), also known as input latency, calculates a website&rsquo;s response time from the first user interaction to the browser&rsquo;s response. Scrolling and zooming cannot be measured with the first input delay as they are classified as animation aspects in the RAIL model. FID focuses solely on the responsiveness of a website, [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/in\/tutorials\/first-input-delay\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":297,"featured_media":59536,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"","rank_math_description":"","rank_math_focus_keyword":"","footnotes":""},"categories":[22613,22615],"tags":[],"class_list":["post-50246","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-digital-marketing","category-seo"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/first-input-delay","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/first-input-delay","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/first-input-delay","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/first-input-delay","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/what-is-first-input-delay-and-how-to-improve-it","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/what-is-first-input-delay-and-how-to-improve-it","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/first-input-delay","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/first-input-delay","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/first-input-delay","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/first-input-delay","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/first-input-delay","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/50246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/users\/297"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/comments?post=50246"}],"version-history":[{"count":32,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/50246\/revisions"}],"predecessor-version":[{"id":109542,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/posts\/50246\/revisions\/109542"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/media\/59536"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/media?parent=50246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/categories?post=50246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/in\/tutorials\/wp-json\/wp\/v2\/tags?post=50246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}