Unused JavaScript / CSS

JavaScript or CSS the browser downloads for a page but never executes or applies during the visit.

code downloaded but never usedwhy am I shipping css for other pagesjavascript the page does not needpurge the css I never useunused javscriptchrome coverage red barsI use three bootstrap classes and ship the whole fileloading a whole library for one feature

See it

Live demo coming soon

What it is

Unused JavaScript and CSS are bytes a page downloads but does not use during the recorded visit. Chrome DevTools Coverage marks JavaScript ranges that never executed and CSS rules that never applied. Common sources are site-wide bundles, libraries imported whole, old styles, and features loaded before anyone opens them. The classic case is a full Bootstrap stylesheet shipped for a handful of grid classes.

Reach for Coverage when the Network panel shows a large script or stylesheet but the current route uses only a sliver of it. Delete dead code, tree-shake unused exports, split route and feature code behind import(), and extract the CSS needed by each page instead of shipping one historical stylesheet everywhere.

Gotcha: unused is session-specific. A menu, error state, media query, or checkout flow can stay red until you trigger it. Record all important states before deleting anything, and safelist class names created dynamically when using PurgeCSS or a similar static scanner.

Ask AI for it

Remove unused JavaScript and CSS from this route. Record Chrome DevTools Coverage while exercising navigation, menus, dialogs, errors, media queries, and authenticated states; rank files by unused transferred bytes. Delete dead modules and rules, replace broad barrel imports with direct imports, split optional features with import(), and configure PurgeCSS with an explicit safelist for runtime-generated class names. Run visual and interaction tests, then report before and after transferred bytes plus Coverage percentages for each changed file.

You might have meant

bundle sizetree shakingcode splittingcritical cssbundle analyzer

Go deeper