CSS, JavaScript and third-party scripts

How code slows a page down, and how to load less of it, later, or not at all: render-blocking files, long tasks and outside tags.

After images, code is what slows most pages down. CSS can hold the first paint back. JavaScript can keep the browser too busy to answer a tap. Tags and widgets from other companies add both. These guides show how to find which files do the damage and how to load them smarter.

If the first paint is slow, start with critical CSS and render-blocking resources and defer, async and modules.

If taps feel slow, read reduce main-thread work and break up long tasks, then use how to fix INP.

If the page carries too much code, see reduce unused code, bundle size and code splitting and remove jQuery.

If other companies' tags are the problem, read third-party scripts. For ways to load work earlier or later, see resource hints and speculation rules. For sites built with a JavaScript framework, read about hydration.

Guides in this topic 15 guides

Start here

Free website audit

Live Google data for any public page: mobile and desktop.

Mobile + desktop · Lighthouse lab test · Real-user Chrome data when Google has it

Rather have this done for you? Speed optimization · Book a call

More topics

For business owners14 guidesSpeed metrics19 guidesImages, video and fonts12 guidesServers and caching11 guidesWordPress and platforms13 guidesTesting and monitoring10 guidesTechnical SEO13 guidesReference7 guidesSpeed Lab12 guides