Web Performance Metrics! TTFB, FCP, LCP, FID, INP, CLS...
Introduction
Initially, I just wanted to write about the explanations of three metrics related to Core Web Vitals … but I found that it is necessary to understand all the metrics, so this article challenges to understand and explain all the web experience metrics proposed by Google.
I realized that it is not necessary to memorize all types of metrics at once, so I created a handy guide along with this article for easy reference and learning:
Measurement of Metrics
Metrics are statistical values designed to objectively measure website experience. Before diving into each metric, let’s understand the basic principles of metric measurement:
Is it happening? | Did the page navigation successfully start? Did the server respond? Related metrics: FFTB, FCP |
Is it useful? | Did it render enough content for users to engage? Related metric: LCP |
Is it usable? | Is the page busy? Can users interact with the page? Related metrics: FID, INP, TTI, TBT |
Is it delightful? | Does the page interaction feel smooth and natural? No delays or flickering? Related metric: CLS |
And the extended types of metrics are as follows:
Perceived Load Speed | The speed at which the page loads and renders all visual elements |
Load Responsiveness | The speed required for the page to load and execute any necessary JavaScript |
Runtime Responsiveness | The speed of response to user interactions after the page has loaded |
Visual Stability | The extent to which content elements change position during the page loading process |
Smoothness | The extent to which a stable frame rate and smoothness are maintained during page changes |
TTFB - Time to First Byte
Measures the time taken from requesting a resource to the first byte response during the webpage loading process. This metric primarily helps understand the speed at which users can obtain resources and is the most fundamental metric before others. A better TTFB indicates that the webpage is “happening,” allowing users to obtain resources more quickly.
FCP - First Contentful Paint
Measures the time taken for the “first content to appear” during the webpage loading process. The content refers to text, images (including background images), <svg>
elements, or non-white <canvas>
elements. In other words, it measures how long it takes for the webpage to display its content. This metric primarily helps understand the loading speed of the webpage; a better FCP can persuade users that the webpage is “happening.”
LCP - Largest Contentful Paint 🌟
Measures the time taken for the “first largest content to appear” during the webpage loading process. The largest content includes:
<img>
elements<image>
elements embedded in<svg>
elements<video>
elements using cover images- Elements with background images loaded via the
url()
function - Child elements of block-level elements that have text nodes or other inline elements
In other words, it measures how long it takes for the webpage to display its largest content. This metric primarily helps understand the user’s experience during webpage loading; a better LCP can persuade users whether the webpage is “useful.”
FID - First Input Delay (replaced by INP) 🌟
Measures the time taken for the first interaction with the website (clicking links, buttons, or using custom JavaScript controls) during the webpage loading process, specifically the “time point when the browser can respond to the interaction.” In other words, it measures how long it takes for the webpage to respond to user interactions, helping understand the interactivity of the webpage; a better FID can persuade users whether the webpage is “usable.”
Specifically, this metric calculates how much time it takes for the browser to react to the user’s first interaction (excluding event handling time), and the results may vary depending on user behavior.
INP - Interaction to Next Paint 🌟
INP replaced FID in March 2024 and also measures how long it takes for the webpage to respond to user interactions, but INP evaluates the overall interaction quality of the webpage rather than just the delay time of the first interaction. Compared to FID, which is a page load metric, INP is more of a metric for testing the overall reliability of the website; a better INP can persuade users whether the webpage is “usable.”
Specifically, this metric observes the delay time experienced during clicks, touches, and keyboard interactions that occur during the user’s visit to the webpage, and it only counts the time from behavior trigger to the main thread being occupied to the point where rendering feedback can begin. In other words, waiting times outside the main thread (e.g., waiting time for sending a form request after pressing a button) are not included.
CLS - Cumulative Layout Shift 🌟
Measuring the “stability of web content,” which is the frequency of changes in the position of web content, this metric primarily helps understand the visual stability of a webpage. A better FID allows users to feel that the webpage is “delightful.”
TTI - Time to Interactive
Measuring how long it takes for users to interact with the webpage, this metric primarily helps understand the interactivity of the webpage. A better TTI can persuade users about the webpage’s “usability.” Webpages may experience delays in execution due to blocking tasks or interfaces controlled by JavaScript that have not fully loaded, which can prevent user interaction. These issues should be measured and avoided as much as possible.
Specifically, this value starts calculating from the time of FCP and finds the end of the last long task during the webpage loading process. This interval is the calculation range for TTI; if there are no long tasks, the TTI value will be based on the FCP time.
TBT - Total Blocking Time
Measuring the time the main thread is blocked between FCP and TTI that affects input responsiveness, which is the length of time the webpage is too busy to respond during loading. This metric primarily helps understand the interactivity of the webpage. A better TBT can persuade users about the webpage’s “usability.” The browser must wait for the task to complete before responding to user interactions. The calculation simulation chart is as follows:
Task Duration | Task Blocking Time | |
---|---|---|
Task One | 250 ms | 200 ms |
Task Two | 90 ms | 40 ms |
Task Three | 35 ms | 0 ms |
Task Four | 30 ms | 0 ms |
Task Five | 155 ms | 105 ms |
Total Blocking Time | 345 ms |
Summary
This article is my advanced digest version. Google’s documentation is already very comprehensive, and for a deeper understanding, you can refer to User-Centric Performance Metrics which provides detailed explanations and translations. As web development evolves, these metrics will also change, so this article will be updated regularly. If you spot any errors or have suggestions, please let me know!
Supplement
Long Tasks
When the main thread executes a single task for more than 50 milliseconds, it is considered a long task. Both TTI and TBT are built on top of the long tasks API.
Core Web Vitals
Core Web Vitals aim to simplify the environment and help websites focus on the most important metrics. If you use Google’s site inspection tools, such as PageSpeed, the above web metrics will be used: LCP, FID, or CLS to score the website, measuring the browsing experience based on performance, interactivity, and visual stability.
Web Page Score Measurement Criteria
The three web metrics mentioned above are defined by Google, with different requirements for mobile devices and computers based on performance differences. For details, you can refer to: Defining Core Web Vitals Thresholds.
Additionally, it is important to note that Google’s search engine aggregates a comprehensive score based on all pages of a website. If 75% of the pages achieve a “Good” rating, then the website will be rated as “Good” under that metric. Therefore, monitoring the scores of all pages within the overall website is crucial.
References
- First Contentful Paint (FCP) - web.dev
- Largest Contentful Paint (LCP) - web.dev
- First Input Delay (FID) - web.dev
- Interaction to Next Paint (INP) - web.dev
- Cumulative Layout Shift (CLS) - web.dev
- Time to First Byte (TTFB) - web.dev
- Time to Interactive (TTI) - web.dev
- Total Blocking Time (TBT) - web.dev