Performance

How to reduce JavaScript on a page

Measure what is actually shipping with the Coverage panel, remove libraries used for one feature, defer everything non-critical, and question whether the page needs a framework at all. Most marketing pages need almost no JavaScript.

Written by Anas Bin Masud 8 steps About 3 hours 270 words

Before you start

  • Access to the build
  • Chrome DevTools

The steps

  1. Step 1: Open the Coverage panel

    DevTools → ⌘⇧P / Ctrl+Shift+P → "Show Coverage" → reload. It reports how much of each file was actually used.

  2. Step 2: Note the unused percentage

    Anything above 60% unused is a candidate for removal or code splitting.

  3. Step 3: List every third-party script

    Analytics, chat widgets, heatmaps, A/B tools, social embeds. Each has a cost and an owner who is not you.

  4. Step 4: Remove what nobody reads

    A heatmap tool nobody has opened in six months is pure cost.

  5. Step 5: Replace single-purpose libraries

    A date library for one format call, or jQuery for one selector, can usually go.

  6. Step 6: Defer the rest

    defer or async on everything not needed for first paint. Load chat widgets on interaction rather than on load.

  7. Step 7: Question the framework

    A brochure site rendered client-side ships a framework to display text. Static generation ships the text.

  8. Step 8: Re-measure with Coverage

    And confirm the page still works with JavaScript disabled if it is content.

The metric it moves

Interaction to Next Paint. Every script competes for the main thread, and a busy main thread is exactly why a tap feels slow. Removing JavaScript is the most direct way to improve INP.

The test that settles the argument

Disable JavaScript and reload. If the content vanishes, you are shipping a framework to display text that could have been in the HTML — and every non-rendering crawler sees the blank version.

The background behind this

Core Web Vitals, and the order that actually reduces them covers the reasoning in about 3 minutes — free, ungated, written from client work.

Who wrote this

Anas Bin Masud builds e-commerce sites and does technical SEO for businesses in the UK, Canada, Ireland and Pakistan. These procedures are the ones I run on client work, written down rather than invented — including the ones where the honest answer is that the fix is not available on your current hosting.

Related procedures

All 64 how-to guides →

Want this done rather than done yourself?

Send the brief and you get a reply within one business day — either questions, or a scoping call. If your project is not something I should take on, I will say so then.

Response
Replies within 1 business day
Hours
Mon–Fri, 09:00–18:00 PKT — overlaps 05:00–14:00 UK, 00:00–09:00 US Eastern
Booking
Booking projects from October 2026
WhatsApp — opens a chat with +92 346 5348466 in a new tab