Cut your web page size down to what visitors need
Every file you send gives the browser more to download or process. Leaving out what the page doesn't use gets visitors to your content sooner.
What counts toward website page weight?
Page weight includes the HTML and the files a page loads, such as images, stylesheets and scripts. Distinguish the bytes transferred over the network from the uncompressed file sizes when you compare results.
How to avoid an excessive DOM size
The DOM is the browser's representation of your HTML. More elements can mean more work to draw and update the page. Remove wrapper elements you don't need, and leave parts of the page that start hidden out of the HTML until a visitor opens them. Google's DOM-size guide explains how structure affects responsiveness.
Minify CSS and JavaScript after removing unused code
Remove code the page doesn't need, then use a production build that minifies the rest. Minifying strips spaces and comments, and in JavaScript it shortens names too. Sending less JavaScript also reduces the work of parsing and compiling it.
Reduce the impact of third-party code
Remove an outside script if it no longer adds clear value. For scripts you keep, consider whether they can wait until the feature is needed. Google's third-party JavaScript guide covers ways to reduce the loading cost.
Frequently asked questions
Why can a small web page still feel slow?
A short download can still leave the browser busy running JavaScript. Check execution time as well as bytes when the page arrives quickly but responds slowly.
Look at images and loading order alongside page size
Website speed
Find what makes your pages slow enough that visitors leave.
Image optimization
Choose smaller image files, reserve their space and delay pictures below the fold.
Render-blocking resources
Bring useful content into view sooner by changing how CSS, scripts and fonts load.