Put JavaScript at Bottom

Like placing CSS at the top of your page to help reduce page load times, putting JavaScript at the bottom of your page will help do the same. While JavaScript is necessary to enable certain functionality of your site, themes, or plugins, for example, JavaScript is also commonly referred to as render blocking files, meaning that sometimes they can prevent certain code, or page elements, to render properly. If the browser parses and tries to render JavaScript, it is possible that may cause your page load to slow down, or even cause your page to not load at all.

If your goal is to present user with content as the page loads, having JavaScript in the header will prevent this from occurring, causing them to wait as everything loads. To avoid this issue, there are a few different methods you can use. If the JavaScript file is small, you can inline them with your HTML document. Otherwise, the next best option is to defer it from loading by putting at the bottom of your document. We will take more about the benefits and how to inline JavaScript in later sections.



Lighthouse is an open-source tool that is used to run an audit against your web pages and provides scores and suggestions for improving page performance, accessibility, SEO, and more.


PageSpeed Terms

PageSpeed Insights is a tool created by Google that reports on the performance of a page on both mobile and desktop devices, and provides suggestions on how that page may be improved.



YSlow is an open-source website analysis tool that can be used to identify web page performance issues. Learn more about the YSlow to enhance your web pages and the user experience.