Avoid @import in CSS
Prevent nested dependency chains by allowing the browser to discover and download CSS files in parallel rather than waiting for parent stylesheets to parse.
70+ tips to optimize your frontend for maximum speed and Core Web Vitals.
@import in CSSPrevent nested dependency chains by allowing the browser to discover and download CSS files in parallel rather than waiting for parent stylesheets to parse.
Eliminate server-side redirects to prevent additional round-trip latency, ensuring the browser can discover and fetch the final document as quickly as possible.
Reduce raw file size through lossy or lossless optimization to decrease total transfer time and lower the impact on Largest Contentful Paint (LCP).
font-displayEnsure text remains visible during font loading by using values like swap for speed or optional for stability, preventing "Flash of Invisible Text" (FOIT).
Implement both algorithms to maximize compression ratios for modern browsers with Brotli while maintaining a stable Gzip fallback for universal compatibility.
Defer the loading of images outside the initial viewport using the loading="lazy" attribute to prioritize critical resources and reduce initial bandwidth usage.
Reduce the number of separate assets requested, lowering total HTTP overhead and streamlining the critical rendering path.
Unblock the render tree by loading stylesheets first, ensuring the CSSOM is ready before scripts execute to prevent layout shifts and a flash of unstyled content (FOUC).
Strip whitespace and comments to reduce file size, speeding up network delivery and accelerating the construction of the CSSOM.
Strip whitespace, comments, and simplify variable names to shrink payload size, reducing both download time and the effort required for the browser to parse the code.
async and deferPrevent external scripts from blocking the HTML parser by downloading them in parallel in the background, speeding up DOM construction and initial page render times.
Use <link rel="preconnect"> to establish early connections to external hosts (like Google Fonts), eliminating DNS, TCP, and TLS latency before the font files are requested.
Use <link rel="preload"> to discover above-the-fold images earlier in the network waterfall, ensuring the fetch starts before the browser parses the full CSS or DOM.
Use <link rel="preload"> to force the browser to download critical local font files immediately, preventing delays caused by waiting for CSS parsing and discovery.
Apply fetchpriority="high" attribute to signal that the hero image is a top-priority resource, ensuring it is fetched ahead of non-critical assets to minimize Largest Contentful Paint (LCP).
Deploy images, scripts, and stylesheets to a Content Delivery Network to reduce the physical distance between the user and the server, lowering latency globally.
Cache-Control headersConfigure robust caching policies to store static resources on the user's device, eliminating network requests entirely for repeat visits and subsequent page views.
Define width and height attributes to reserve space for images during layout, preventing Cumulative Layout Shift (CLS) when the assets finally load.
Mark scroll and touch listeners as passive to prevent the handler from blocking the main thread, allowing the browser to perform scrolling immediately.
Leverage superior Brotli compression to provide the smallest possible file sizes, ensuring faster downloads and broad compatibility with all modern browsers.
Offload animations to the GPU using compositor-only properties like transform, avoiding expensive reflows and repaints triggered by properties like top, left, width, or height.
Perform all DOM measurements first (e.g. offsetWidth), then perform all DOM mutations and style updates to prevent multiple forced synchronous reflows within a single frame ("layout thrashing").
Reduce raw file size using lossy optimization to decrease transfer time and bandwidth consumption without significantly impacting visual quality.
Configure build tools to identify and remove unused code from final production assets, shrinking bundle sizes and reducing the time the browser spends parsing and compiling.
Extract initial viewport styles to a <style> tag in the <head> and defer all remaining CSS to eliminate render-blocking delays and accelerate Largest Contentful Paint (LCP).
Use import() to fetch code only when needed, shrinking the initial bundle size and reducing the main-thread effort required for the first paint.
Eliminate dead code to shrink the critical path payload, ensuring the browser does not waste resources parsing styles that are not applied.
Swap unnecessary dependencies (e.g. Lodash, Moment.js) for native browser features (e.g. modern array methods, Temporal API) to shrink bundle sizes and reduce script evaluation time.
srcset for responsive imagesProvide a list of image variants at different widths, allowing the browser to download the smallest version that matches the user's device resolution.
Implement AV1 or VP9 in WebM containers to achieve superior compression over H.264, delivering high-quality video at significantly lower bitrates.
Move animation logic to the browser's native animation engine to reduce CPU overhead and ensure smooth motion even during heavy background tasks.
Leverage superior compression to provide significantly smaller files than JPEG or PNG, reducing total download time without sacrificing visual quality.
Serve cached data to repeat visitors immediately while silently fetching updates in the background, allowing the UI to render instantly and then refresh automatically once the latest data arrives.
Deploy a programmable network proxy to intercept requests and manage a local cache of core assets such as HTML, CSS, JS bundles, and fonts, ensuring the application shell loads instantly regardless of network reliability.
Execute dynamic page generation on distributed edge servers to deliver HTML from the nearest geographic location to the user, drastically reducing Time to First Byte (TTFB).
Move non-essential tracking, analytics, or ad scripts to a background thread to prevent them from blocking the main thread and interfering with user interactions.
Generate static HTML at build time or on the server to deliver a fully formed document instantly, accelerating both Time to First Byte (TTFB) and initial content paints.
Deliver the document in chunks to allow the browser to begin parsing and downloading resources before the entire response is fully generated, significantly improving Time to First Byte.
Implement adaptive bitrate streaming protocols to deliver video in segments, allowing the browser to adjust quality dynamically based on the user's network speed.
Deliver only the JavaScript required for the current route to minimize initial bundle size and accelerate both parsing and execution times.
Render only the DOM nodes currently visible in the viewport to keep the main thread responsive and maintain smooth scroll performance even with thousands of data rows.
Apply loading="lazy" or use Intersection Observer to defer video fetching until they approach the viewport, prioritizing critical above-the-fold resources.
preload attributesSet preload="none" or preload="metadata" for non-critical videos to prevent automatic full-file downloads, saving significant bandwidth and reducing network contention.
Execute multiple independent asynchronous tasks using methods like Promise.all() or Promise.allSettled() to reduce the total duration of the execution path.
font-size-adjust for font fallbacksMaintain consistent visual scale when switching to fallback fonts, minimizing layout shifts by aligning the x-height across typefaces.
Apply content-visibility: auto to heavy off-screen DOM subtrees (e.g. widgets, embeds, or long lists) to avoid unnecessary layout and paint cycles. Always pair with contain-intrinsic-size to provide a placeholder size and prevent layout shifts during scroll.
Configure JSON rules within a <script type="speculationrules"> element to prefetch or prerender upcoming pages in the background, enabling near-instant transitions.
Remove unnecessary audio tracks from background or decorative videos to shrink the network payload and prevent the browser from initializing audio decoders.
requestAnimationFrameReplace standard JS loops (e.g., setInterval) for tasks where the Web Animations API is unavailable, such as <canvas> or WebGL, to align execution with the browser's native refresh rate.
Attach a single listener to a parent element rather than many to individual children, reducing memory usage and the overhead of managing multiple DOM listeners.
Implement adaptive loading using signals like navigator.deviceMemory, navigator.hardwareConcurrency (CPU count) and Save-Data preferences to serve lightweight assets and defer heavy scripts on constrained devices or networks.
Use native @container rules to handle how components adapt to their container's size, eliminating expensive JS resize listeners and freeing up the main thread.
Postpone event handler execution for actions like resize or keyup until a specified period of inactivity, preventing redundant calculations and main-thread congestion.
Apply the contain property to heavy or dynamic DOM subtrees (e.g. widgets, embeds, or long lists) to limit layout and paint recalculations to those specific components and prevent global reflows.
Target modern browser versions in your build configuration to reduce the need for bulky polyfills and legacy helper code, resulting in smaller, faster bundles.
Strip metadata, hidden layers, and unnecessary precision from SVG files to reduce the total size of the DOM and network payload.
requestIdleCallbackExecute non-urgent background work during the browser's idle periods to prevent long tasks from blocking critical user input and maintaining a responsive main thread.
Host CSS, fonts, and hero images on your primary domain to bypass the DNS, TCP, and TLS overhead required for external connections.
Use the QUIC-based HTTP/3 protocol to eliminate head-of-line blocking and accelerate secure connection handshakes for faster delivery across all network types.
Remove unused glyphs and language sets from font files to drastically reduce individual file sizes and decrease total download time.
Limit the execution rate of rapidly repeating logic to maintain a consistent frame rate and prevent main-thread exhaustion during continuous actions such as scrolling.
<picture> for responsive imagesAllow the browser to select the most appropriate image source based on viewport size or format support, ensuring users only download what is necessary.
Group inline SVG symbols into a single definition to reduce redundant markup and DOM nodes while allowing efficient icon reuse across the page.
Replace multiple static files with a single file containing all weights and styles, reducing HTTP requests and total file size.
Use a background thread for CPU-intensive tasks like data processing or complex filtering to prevent UI freezes and maintain a responsive interface.
Lower memory overhead while accelerating style recalculations and layout reflows by minimizing the effort required by the browser to traverse and paint the node tree.
will-changeInform the browser of upcoming heavy animations to pre-optimize rendering layers, preventing frame drops and visual jank during complex transitions.
Remove whitespace, comments, and redundant attributes to shrink payload size and accelerate parsing for faster initial rendering.
Apply decoding="async" to process large or complex image data on a background thread, preventing main-thread "jank" and keeping the UI responsive during rendering.
Ensure all resources utilize HTTPS to prevent mixed-content warnings and allow the browser to reuse existing encrypted connections for faster parallel downloading.
Replace redundant DOM nodes with ::before and ::after to reduce the total node count that the browser must manage and paint.
Reduce style-matching complexity by avoiding deep nesting, allowing the browser to calculate styles and reflow the layout faster.
No items match your filters