Improving issues with a Lighthouse Web Audit
Learn how you can improve your website's usability and speed by updating your code.
Boosting your website with Web Audits
You can better understand the coding changes needed for your website below is what you would need to update to improve your website's speed, user experience and overall rankings for Lighthouse.
Performance
Values are estimated and may vary. The performance score is calculated directly from these metrics.
First Contentful Paint
First Contentful Paint marks the time at which the first text or image is painted.
Speed Index
Speed Index shows how quickly the contents of a page are visibly populated.
Largest Contentful Paint
Largest Contentful Paint marks the time at which the largest text or image is painted.
Time to Interactive
Time to interactive is the amount of time it takes for the page to become fully interactive.
Total Blocking Time
Sum of all time periods between FCP and Time to Interactive, when task length exceeded 50ms, expressed in milliseconds.
Cumulative Layout Shift
Cumulative Layout Shift measures the movement of visible elements within the viewport.
Avoid chaining critical requests
The Critical Request Chains below show you what resources are loaded with a high priority. Consider reducing the length of chains, reducing the download size of resources, or deferring the download of unnecessary resources to improve page load.
Keep request counts low and transfer sizes small
To set budgets for the quantity and size of page resources, add a budget.json file.
Largest Contentful Paint element
This is the largest contentful element painted within the viewport.
Avoid long main-thread tasks
Lists the longest tasks on the main thread, useful for identifying worst contributors to input delay.
Avoid long main-thread tasks
Lists the longest tasks on the main thread, useful for identifying worst contributors to input delay.
Eliminate render-blocking resources
Resources are blocking the first paint of your page. Consider delivering critical JS/CSS inline and deferring all non-critical JS/styles.
Properly size images
Serve images that are appropriately-sized to save cellular data and improve load time.
Defer offscreen images
Consider lazy-loading offscreen and hidden images after all critical resources have finished loading to lower time to interactive.
Minify CSS
Minifying CSS files can reduce network payload sizes.
Minify JavaScript
Minifying JavaScript files can reduce payload sizes and script parse time.
Reduce unused CSS
Reduce unused rules from stylesheets and defer CSS not used for above-the-fold content to decrease bytes consumed by network activity.
Reduce unused JavaScript
Reduce unused JavaScript and defer loading scripts until they are required to decrease bytes consumed by network activity.
Efficiently encode images
Optimized images load faster and consume less cellular data.
Serve images in next-gen formats
Image formats like WebP and AVIF often provide better compression than PNG or JPEG, which means faster downloads and less data consumption.
Enable text compression
Text-based resources should be served with compression (gzip, deflate or brotli) to minimize total network bytes.
Preconnect to required origins
Consider adding `preconnect` or `dns-prefetch` resource hints to establish early connections to important third-party origins.
Initial server response time was short Root document took 100 ms
Keep the server response time for the main document short because all other requests depend on it.
Avoid multiple page redirects
Redirects introduce additional delays before the page can be loaded.
Preload key requests
Consider using `<link rel=preload>` to prioritize fetching resources that are currently requested later in page load.
Use HTTP/2
HTTP/2 offers many benefits over HTTP/1.1, including binary headers and multiplexing.
Use video formats for animated content
Large GIFs are inefficient for delivering animated content. Consider using MPEG4/WebM videos for animations and PNG/WebP for static images instead of GIF to save network bytes.
Remove duplicate modules in JavaScript bundles
Remove large, duplicate JavaScript modules from bundles to reduce unnecessary bytes consumed by network activity.
Avoid serving legacy JavaScript to modern browsers
Polyfills and transforms enable legacy browsers to use new JavaScript features. However, many aren't necessary for modern browsers. For your bundled JavaScript, adopt a modern script deployment strategy using module/nomodule feature detection to reduce the amount of code shipped to modern browsers, while retaining support for legacy browsers.
Preload Largest Contentful Paint image
Preload the image used by the LCP element in order to improve your LCP time.
Avoids enormous network payloads
Large network payloads cost users real money and are highly correlated with long load times.
Uses efficient cache policy on static assets
A long cache lifetime can speed up repeat visits to your page.
Avoids an excessive DOM size
A large DOM will increase memory usage, cause longer style calculations, and produce costly layout reflows.
User Timing marks and measures
Consider instrumenting your app with the User Timing API to measure your app's real-world performance during key user experiences.
JavaScript execution time
Consider reducing the time spent parsing, compiling, and executing JS. You may find delivering smaller JS payloads helps with this.
Minimizes main-thread work
Consider reducing the time spent parsing, compiling and executing JS. You may find delivering smaller JS payloads helps with this.
All text remains visible during webfont loads
Leverage the font-display CSS feature to ensure text is user-visible while webfonts are loading.
Minimize third-party usage
Third-party code can significantly impact load performance. Limit the number of redundant third-party providers and try to load third-party code after your page has primarily finished loading.
Lazy load third-party resources with facades
Some third-party embeds can be lazy loaded. Consider replacing them with a facade until they are required.
Largest Contentful Paint image was not lazily loaded
Above-the-fold images that are lazily loaded render later in the page lifecycle, which can delay the largest contentful paint.
Avoid large layout shifts
These DOM elements contribute most to the CLS of the page.
Uses passive listeners to improve scrolling performance
Consider marking your touch and wheel event listeners as `passive` to improve your page's scroll performance.
Avoids document.write()
For users on slow connections, external scripts dynamically injected via `document.write()` can delay page load by tens of seconds.
Avoid non-composited animations
Animations which are not composited can be janky and increase CLS.
Image elements have explicit width and height
Set an explicit width and height on image elements to reduce layout shifts and improve CLS.
Has a tag with width or initial-scale
A <meta name="viewport">not only optimizes your app for mobile screen sizes, but also prevents a 300 millisecond delay to user input.
Avoids unload event listeners
The `unload` event does not fire reliably and listening for it can prevent browser optimizations like the Back-Forward Cache. Use `pagehide` or `visibilitychange` events instead.
Accessibility
These checks highlight opportunities to improve the accessibility of your web app. Only a subset of accessibility issues can be automatically detected so manual testing is also encouraged.
The page has a logical tab order
Tabbing through the page follows the visual layout. Users cannot focus elements that are offscreen.
Interactive controls are keyboard focusable
Custom interactive controls are keyboard focusable and display a focus indicator.
Interactive elements indicate their purpose and state
Interactive elements, such as links and buttons, should indicate their state and be distinguishable from non-interactive elements.
The user's focus is directed to new content added to the page
If new content, such as a dialog, is added to the page, the user's focus is directed to it.
User focus is not accidentally trapped in a region
A user can tab into and out of any control or region without accidentally trapping their focus.
Custom controls have associated labels
Custom interactive controls have associated labels, provided by aria-label or aria-labelledby.
Custom controls have ARIA roles
Custom interactive controls have appropriate ARIA roles.
Visual order on the page follows DOM order
DOM order matches the visual order, improving navigation for assistive technology.
Offscreen content is hidden from assistive technology
Offscreen content is hidden with display: none or aria-hidden=true.
HTML5 landmark elements are used to improve navigation
Landmark elements (<main>, <nav>, etc.) are used to improve the keyboard navigation of the page for assistive technology.
[aria-hidden="true"] is not present on the document <body>
Assistive technologies, like screen readers, work inconsistently when `aria-hidden="true"` is set on the document `<body>`.
[role]s have all required [aria-*] attributes
Some ARIA roles have required attributes that describe the state of the element to screen readers.
[role] values are valid
ARIA roles must have valid values in order to perform their intended accessibility functions.
Buttons have an accessible name
When a button doesn't have an accessible name, screen readers announce it as "button", making it unusable for users who rely on screen readers.
Image elements have [alt] attributes
Informative elements should aim for short, descriptive alternate text. Decorative elements can be ignored with an empty alt attribute.
[user-scalable="no"] is not used in the <meta name="viewport">element and the [maximum-scale] attribute is not less than 5.
Disabling zooming is problematic for users with low vision who rely on screen magnification to properly see the contents of a web page.
The page contains a heading, skip link, or landmark region
Adding ways to bypass repetitive content lets keyboard users navigate the page more efficiently.
Background and foreground colors have a sufficient contrast ratio
Low-contrast text is difficult or impossible for many users to read.
Document has a <title>element
The title gives screen reader users an overview of the page, and search engine users rely on it heavily to determine if a page is relevant to their search.
<html>element has a [lang] attribute
If a page doesn't specify a lang attribute, a screen reader assumes that the page is in the default language that the user chose when setting up the screen reader. If the page isn't actually in the default language, then the screen reader might not announce the page's text correctly.
<html>element has a valid value for its [lang] attribute
Specifying a valid BCP 47 language helps screen readers announce text properly.
Links have a discernible name
Link text (and alternate text for images, when used as links) that is discernible, unique, and focusable improves the navigation experience for screen reader users.
Lists contain only <li>elements and script supporting elements (<script>and <template>).
Screen readers have a specific way of announcing lists. Ensuring proper list structure aids screen reader output.
List items (<li>) are contained within <ul>or <ol>parent elements
Screen readers require list items (`<li>`) to be contained within a parent `<ul>` or `<ol>` to be announced properly.
Heading elements appear in a sequentially-descending order
Properly ordered headings that do not skip levels convey the semantic structure of the page, making it easier to navigate and understand when using assistive technologies.
[accesskey] values are unique
Access keys let users quickly focus a part of the page. For proper navigation, each access key must be unique.
[aria-*] attributes match their roles
Each ARIA `role` supports a specific subset of `aria-*` attributes. Mismatching these invalidates the `aria-*` attributes.
button, link, and menuitem elements have accessible names
When an element doesn't have an accessible name, screen readers announce it with a generic name, making it unusable for users who rely on screen readers.
[aria-hidden="true"] elements do not contain focusable descendents
Focusable descendents within an `[aria-hidden="true"]` element prevent those interactive elements from being available to users of assistive technologies like screen readers.
ARIA input fields have accessible names
When an input field doesn't have an accessible name, screen readers announce it with a generic name, making it unusable for users who rely on screen readers.
ARIA meter elements have accessible names
When an element doesn't have an accessible name, screen readers announce it with a generic name, making it unusable for users who rely on screen readers.
ARIA progressbar elements have accessible names
When a `progressbar` element doesn't have an accessible name, screen readers announce it with a generic name, making it unusable for users who rely on screen readers.
Elements with an ARIA [role] that require children to contain a specific [role] have all required children.
Some ARIA parent roles must contain specific child roles to perform their intended accessibility functions. [
role]s are contained by their required parent element
Some ARIA child roles must be contained by specific parent roles to properly perform their intended accessibility functions.
ARIA toggle fields have accessible names
When a toggle field doesn't have an accessible name, screen readers announce it with a generic name, making it unusable for users who rely on screen readers.
ARIA tooltip elements have accessible names
When an element doesn't have an accessible name, screen readers announce it with a generic name, making it unusable for users who rely on screen readers.
ARIA treeitem elements have accessible names
When an element doesn't have an accessible name, screen readers announce it with a generic name, making it unusable for users who rely on screen readers.
[aria-*] attributes have valid values
Assistive technologies, like screen readers, can't interpret ARIA attributes with invalid values.
[aria-*] attributes are valid and not misspelled
Assistive technologies, like screen readers, can't interpret ARIA attributes with invalid names.
<dl>'s contain only properly-ordered <dt>and <dd>groups, <script>, <template>or <div>elements.
When definition lists are not properly marked up, screen readers may produce confusing or inaccurate output.
Definition list items are wrapped in <dl<elements
Definition list items (`<dt>` and `<dd>`) must be wrapped in a parent `<dl>` element to ensure that screen readers can properly announce them.
[id] attributes on active, focusable elements are unique
All focusable elements must have a unique `id` to ensure that they're visible to assistive technologies.
ARIA IDs are unique
The value of an ARIA ID must be unique to prevent other instances from being overlooked by assistive technologies.
No form fields have multiple labels
Form fields with multiple labels can be confusingly announced by assistive technologies like screen readers which use either the first, the last, or all of the labels.
<frame> or <iframe> elements have a title
Screen reader users rely on frame titles to describe the contents of frames.
<input type="image">elements have [alt] text
When an image is being used as an `<input>` button, providing alternative text can help screen reader users understand the purpose of the button.
Form elements have associated labels
Labels ensure that form controls are announced properly by assistive technologies, like screen readers.
The document does not use <meta http-equiv="refresh">
Users do not expect a page to refresh automatically, and doing so will move focus back to the top of the page. This may create a frustrating or confusing experience.
<object>elements have alternate text
Screen readers cannot translate non-text content. Adding alternate text to `<object>` elements helps screen readers convey meaning to users.
No element has a [tabindex] value greater than 0
A value greater than 0 implies an explicit navigation ordering. Although technically valid, this often creates frustrating experiences for users who rely on assistive technologies.
Cells in a <table>element that use the [headers] attribute refer to table cells within the same table.
Screen readers have features to make navigating tables easier. Ensuring `<d>` cells using the `[headers]` attribute only refer to other cells in the same table may improve the experience for screen reader users.
<th>elements and elements with [role="columnheader"/"rowheader"] have data cells they describe.
Screen readers have features to make navigating tables easier. Ensuring table headers always refer to some set of cells may improve the experience for screen reader users.
[lang] attributes have a valid value
Specifying a valid BCP 47 language on elements helps ensure that text is pronounced correctly by a screen reader.
<video>elements contain a <track>element with [kind="captions"]
When a video provides a caption it is easier for deaf and hearing impaired users to access its information.
Best Practices
It analyzes whether HTTPS and HTTP/2 are used, checks to see whether resources come from secure sources and assesses the vulnerability of JavaScript libraries. Other best practices look at secure database connections and avoiding the use of non-secure commands, such as document.
Ensure CSP is effective against XSS attacks
A strong Content Security Policy (CSP) significantly reduces the risk of cross-site scripting (XSS) attacks.
Uses HTTPS
All sites should be protected with HTTPS, even ones that don't handle sensitive data. This includes avoiding mixed content, where some resources are loaded over HTTP despite the initial request being served over HTTPS. HTTPS prevents intruders from tampering with or passively listening in on the communications between your app and your users, and is a prerequisite for HTTP/2 and many new web platform APIs.
Avoids requesting the geolocation permission on page load
Users are mistrustful of or confused by sites that request their location without context. Consider tying the request to a user action instead.
Avoids requesting the notification permission on page load
Users are mistrustful of or confused by sites that request to send notifications without context. Consider tying the request to user gestures instead.
Avoids front-end JavaScript libraries with known security vulnerabilities
Some third-party scripts may contain known security vulnerabilities that are easily identified and exploited by attackers.
Allows users to paste into password fields
Preventing password pasting undermines good security policy.
Displays images with correct aspect ratio
Image display dimensions should match natural aspect ratio.
Serves images with appropriate resolution
Image natural dimensions should be proportional to the display size and the pixel ratio to maximize image clarity.
Page has the HTML doctype
Specifying a doctype prevents the browser from switching to quirks-mode.
Properly defines charset
A character encoding declaration is required. It can be done with a `` tag in the first 1024 bytes of the HTML or in the Content-Type HTTP response header.
Avoids deprecated APIs
Deprecated APIs will eventually be removed from the browser.
No browser errors logged to the console
Errors logged to the console indicate unresolved problems. They can come from network request failures and other browser concerns.
No issues in the Issues panel in Chrome Devtools
Issues logged to the `Issues` panel in Chrome Devtools indicate unresolved problems. They can come from network request failures, insufficient security controls, and other browser concerns. Open up the Issues panel in Chrome DevTools for more details on each issue.
Page has valid source maps
Source maps translate minified code to the original source code. This helps developers debug in production. In addition, Lighthouse is able to provide further insights. Consider deploying source maps to take advantage of these benefits.
Fonts with font-display: optional are preloaded
Preload `optional` fonts so first-time visitors may use them.
Detected JavaScript libraries
All front-end JavaScript libraries detected on the page.
SEO
These checks ensure that your page is following basic search engine optimization advice. There are many additional factors Lighthouse does not score here that may affect your search ranking, including performance on Core Web Vitals.
Structured data is valid
Run the Structured Data Testing Tool and the Structured Data Linter to validate structured data.
Has a <meta name="viewport">tag with width or initial-scale
A `<meta name="viewport">` not only optimizes your app for mobile screen sizes, but also prevents a 300 millisecond delay to user input.
Document has a <title> element
The title gives screen reader users an overview of the page, and search engine users rely on it heavily to determine if a page is relevant to their search.
Document has a meta description
Meta descriptions may be included in search results to concisely summarize page content.
Page has successful HTTP status code
Pages with unsuccessful HTTP status codes may not be indexed properly.
Links have descriptive text
Descriptive link text helps search engines understand your content.
Links are crawlable
Search engines may use `href` attributes on links to crawl websites. Ensure that the `href` attribute of anchor elements links to an appropriate destination, so more pages of the site can be discovered.
Page isn’t blocked from indexing
Search engines are unable to include your pages in search results if they don't have permission to crawl them.
Image elements have [alt] attributes
Informative elements should aim for short, descriptive alternate text. Decorative elements can be ignored with an empty alt attribute.
Document has a valid hreflang
hreflang links tell search engines what version of a page they should list in search results for a given language or region.
Document has a valid rel=canonical
Canonical links suggest which URL to show in search results.
Document uses legible font sizes 100% legible text
Font sizes less than 12px are too small to be legible and require mobile visitors to 'pinch to zoom' in order to read. Strive to have >60% of page text ≥12px.
Document avoids plugins
Search engines can't index plugin content, and many devices restrict plugins or don't support them.
Tap targets are sized appropriately 100% appropriately sized tap targets
Interactive elements like buttons and links should be large enough (48x48px), and have enough space around them, to be easy enough to tap without overlapping onto other elements.
robots.txt is valid
If your robots.txt file is malformed, crawlers may not be able to understand how you want your website to be crawled or indexed.