Performance is a huge subject, but it's not always a "back-end" or an "admin" subject: it's a Front-End responsibility too. The Front-End Performance Checklist is an exhaustive list of elements you should check or at least be aware of, as a Front-End developer and apply to your project (personal and professional).
How to use?
For each rule, you will have a paragraph explaining why this rule is important and how you can fix it. For more deep information, you should find links that will point to 🛠 tools, 📖 articles or 📹 medias that can complete the checklist.
All items in the Front-End Performance Checklist are essentials to achieve the highest performance score but you would find an indicator to help you to eventually prioritised some rules amount others. There are 3 levels of priority:
- ![Low][low] means that the item has a low priority.
- ![Medium][medium] means that the item has a medium priority. You shouldn't avoid tackling that item.
- ![High][high] means that the item has a high priority. You can't avoid following that rule and implement the corrections recommended.
List of the tools you can use to test or monitor your website or application:
- 🛠 WebPagetest - Website Performance and Optimization Test
- 🛠 ☆ Dareboost: Website Speed Test and Website Analysis (use the coupon WPCDD20 for -20%)
- 🛠 Treo: Page Speed Monitoring
- 🛠 GTmetrix | Website Speed and Performance Optimization
- 🛠 PageSpeed Insights
- 🛠 Web.dev
- 🛠 Pingdom Website Speed Test
- 📖 Make the Web Faster | Google Developers
- 🛠 Sitespeed.io - Welcome to the wonderful world of Web Performance
- 🛠 Calibre
- 🛠 Website Speed Test | Check Web Performance » Dotcom-Tools
- 🛠 Website and Server Uptime Monitoring - Pingdom (Free Signup Link)
- 🛠 Uptime Robot
- 🛠 SpeedCurve: Monitor front-end performance
- 🛠 PWMetrics - CLI tool and lib to gather performance metrics
- 🛠 Varvy - Page speed optimization
- 🛠 Lighthouse - Google
- 🛠 Checkbot browser extension - Checks for web performance best practices
- 🛠 Yellow Lab Tools | Online test to help speeding up heavy web pages
- 🛠 Speedrank - Web Performance Monitoring
- 🛠 DebugBear - Monitor website performance and Lighthouse scores
- 🛠 packtracker.io - Check your webpack bundle size on every pull request.
- 🛠 Exthouse - Analyze the impact of a browser extension on web performance
- AddyOsmani.com - Start Performance Budgeting
- 📖 Get Started With Analyzing Runtime Performance | Google Developers
- 📖 State of the Web | 2018_01_01
- 📖 Page Weight Doesn't Matter
- 📖 Front-End Performance Checklist 2018 [PDF, Apple Pages]
- 📖 Designing for Performance Weighing Aesthetics and Speed - By Lara Callender Hogan [eBook, Print]
- 📖 Varvy - Web performance glossary
- 📖 fabkrum/web-performance-resources: Up to date collection of valuable web performance resources
- 📖 Checkbot - Web Speed Best Practices
- 🛠 Progressive Tooling - A list of community-built, third-party tools that can be used to improve page performance
Minified HTML: ![medium] The HTML code is minified, comments, white spaces and new lines are removed from production files.
Removing all unnecessary spaces, comments and attributes will reduce the size of your HTML and speed up your site's page load times and obviously lighten the download for your user.
Most of the frameworks have plugins to facilitate the minification of the webpages. You can use a bunch of NPM modules that can do the job for you automatically.
<!-- Not recommended --> <script src="jquery.js"></script> <script src="foo.js"></script> <link rel="stylesheet" href="foo.css"/> <!-- Recommended --> <link rel="stylesheet" href="foo.css"/> <script src="jquery.js"></script> <script src="foo.js"></script>
⁃ Ensure that
<head>are always before your
Minimize the number of iframes: ![high] Use iframes only if you don't have any other technical possibility. Try to avoid iframes as much as you can.
Pre-load optimization with prefetch, dns-prefetch and prerender: ![low] Popular browsers can use directive on
<link>tag and "rel" attribute with certain keywords to pre-load specific URLs.
Prefetching allows a browser to silently fetch the necessary resources needed to display content that a user might access in the near future. The browser is able to store these resources in its cache and speed up the way web pages load when they are using different domains for page resources. When a web page has finished loading and the idle time has passed, the browser begins downloading other resources. When a user go in a particular link (already prefetched), the content will be instantly served.
⁃ Ensure that
<link>is in your
Minification: ![high] All CSS files are minified, comments, white spaces and new lines are removed from production files.
When CSS files are minified, the content is loaded faster and less data is sent to the client. It's important to always minify CSS files in production. It is beneficial for the user as it is for any business who wants to lower bandwidth costs and lower resource usage.
⁃ Use tools to minify your files automatically before or during your build or your deployment.
Concatenation: ![medium] CSS files are concatenated in a single file (Not always valid for HTTP/2).
<!-- Not recommended --> <link rel="stylesheet" href="foo.css"/> <link rel="stylesheet" href="bar.css"/> <!-- Recommended --> <link rel="stylesheet" href="foobar.css"/>
If you are still using HTTP/1, you may need to still concatenate your files, it's less true if your server use HTTP/2 (tests should be made).
⁃ Use online tool or any plugin before or during your build or your deployment to concatenate your files. ⁃ Ensure, of course, that concatenation does not break your project.
Non-blocking: ![high] CSS files need to be non-blocking to prevent the DOM from taking time to load.
<link rel="preload" href="global.min.css" as="style" onload="this.rel='stylesheet'"> <noscript><link rel="stylesheet" href="global.min.css"></noscript>
CSS files can block the page load and delay the rendering of your page. Using
preloadcan actually load the CSS files before the browser starts showing the content of the page.
⁃ You need to add the
relattribute with the
preloadvalue and add
Unused CSS: ![medium] Remove unused CSS selectors.
Removing unused CSS selectors can reduce the size of your files and then speed up the load of your assets.
⁃ ⚠️ Always check if the framework CSS you want to use don't already has a reset / normalize code included. Sometimes you may not need everything that is inside your reset / normalize file.
CSS Critical: ![high] The CSS critical (or "above the fold") collects all the CSS used to render the visible portion of the page. It is embedded before your principal CSS call and between
<style></style>in a single line (minified if possible).
*Why:* > Inlining critical CSS help to speed up the rendering of the web pages reducing the number of requests to the server. *How:* > Generate the CSS critical with online tools or using a plugin like the one that Addy Osmani developed. * 📖 [Understanding Critical CSS](https://www.smashingmagazine.com/2015/08/understanding-critical-css/) * 🛠 [Critical by Addy Osmani on GitHub](https://github.com/addyosmani/critical) automates this. * 📖 [Inlining critical CSS for better web performance | Go Make Things](https://gomakethings.com/inlining-critical-css-for-better-web-performance/) * 🛠 [Critical Path CSS Generator - Prioritize above the fold content :: SiteLocity](https://www.sitelocity.com/critical-path-css-generator) * 📖 [Reduce the size of the above-the-fold content
Embedded or inline CSS: ![high] Avoid using embed or inline CSS inside your
<body>(Not valid for HTTP/2)
One of the first reason it's because it's a good practice to separate content from design. It also helps you have a more maintainable code and keep your site accessible. But regarding performance, it's simply because it decreases the file-size of your HTML pages and the load time.
Always use external stylesheets or embed CSS in your
<head>(and follow the others CSS performance rules)
Analyse stylesheets complexity: ![high] Analyzing your stylesheets can help you to flag issues, redundancies and duplicate CSS selectors.
Sometimes you may have redundancies or validation errors in your CSS, analysing your CSS files and removed these complexities can help you to speed up your CSS files (because your browser will read them faster)
Your CSS should be organized, using a CSS preprocessor can help you with that. Some online tools listed below can also help you analysing and correct your code.
- 🛠 TestMyCSS | Optimize and Check CSS Performance
- 🛠 CSS Stats
- 🛠 macbre/analyze-css: CSS selectors complexity and performance analyzer
- 🛠 Project Wallace is like CSS Stats but stores stats over time so you can track your changes
Webfont formats: ![medium] You are using WOFF2 on your web project or application.
According to Google, the WOFF 2.0 Web Font compression format offers 30% average gain over WOFF 1.0. It's then good to use WOFF 2.0, WOFF 1.0 as a fallback and TTF.
Check before buying your new font that the provider gives you the WOFF2 format. If you are using a free font, you can always use Font Squirrel to generate all the formats you need.
preconnectto load your fonts faster: ![medium]
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
When you arrived on a website, your device needs to find out where your site lives and which server it needs to connect with. Your browser had to contact a DNS server and wait for the lookup complete before fetching the resource (fonts, CSS files...). Prefetches and preconnects allow the browser to lookup the DNS information and start establishing a TCP connection to the server hosting the font file. This provides a performance boost because by the time the browser gets around to parsing the css file with the font information and discovering it needs to request a font file from the server, it will already have pre-resolved the DNS information and have an open connection to the server ready in its connection pool.
⁃ Before prefetching your webfonts, use webpagetest to evaluate your website ⁃ Look for teal colored DNS lookups and note the host that are being requested ⁃ Prefetch your webfonts in your
<head>and add eventually these hostnames that you should prefetch too
- 📖 Faster Google Fonts with Preconnect - CDN Planet
- 📖 Make Your Site Faster with Preconnect Hints | Viget
- 📖 Ultimate Guide to Browser Hints: Preload, Prefetch, and Preconnect - MachMetrics Speed Blog
- 📖 A Comprehensive Guide to Font Loading Strategies—zachleat.com
- 🛠 typekit/webfontloader: Web Font Loader gives you added control when using linked fonts via @font-face.
Webfont size: ![medium] Webfont sizes don't exceed 300kb (all variants included)
- Prevent Flash or Invisible Text: ![medium] Avoid transparent text until the Webfont is loaded
Images optimization: ![high] Your images are optimized, compressed without direct impact to the end user.
Optimized images load faster in your browser and consume less data.
⁃ Try using CSS3 effects when it's possible (instead of a small image) ⁃ When it's possible, use fonts instead of text encoded in your images ⁃ Use SVG ⁃ Use a tool and specify a level compression under 85.
- 📖 Image Optimization | Web Fundamentals | Google Developers
- 📖 Essential Image Optimization - An eBook by Addy Osmani
- 🛠 TinyJPG – Compress JPEG images intelligently
- 🛠 Kraken.io - Online Image Optimizer
- 🛠 Compressor.io - optimize and compress JPEG photos and PNG images
- 🛠 Cloudinary - Image Analysis Tool
- 🛠 ImageEngine - Image Webpage Loading Test
- 🛠 SVGOMG - Optimize SVG vector graphics files
Images format: ![high] Choose your image format appropriately.
To ensure that your images don't slow your website, choose the format that will correspond to your image. If it's a photo, JPEG is most of the time more appropriate than PNG or GIF. But don't forget to look a the nex-gen formats which can reduce the size of your files. Each image format has pros and cons, it's important to know these to make the best choice possible.
⁃ Use Lighthouse to identify which images can eventually use next-gen formats (like JPEG 2000m JPEG XR or WebP) ⁃ Compare different formats, sometimes using PNG8 is better than PNG16, sometimes it's not.
Use vector image vs raster/bitmap: ![medium] Prefer using vector image rather than bitmap images (when possible).
Vector images (SVG) tend to be smaller than images and SVG's are responsive and scale perfectly. These images can be animated and modified by CSS.
Images dimensions: ![medium] Set
<img>if the final rendered image size is known.
If height and width are set, the space required for the image is reserved when the page is loaded. However, without these attributes, the browser does not know the size of the image, and cannot reserve the appropriate space to it. The effect will be that the page layout will change during loading (while the images load).
Avoid using Base64 images: ![medium] You could eventually convert tiny images to base64 but it's actually not the best practice.
Lazy loading: ![medium] Offscreen images are loaded lazily (A noscript fallback is always provided).
It will improve the response time of the current page and then avoid loading unnecessary images that the user may not need.
Responsive images: ![medium] Ensure to serve images that are close to your display size.
Small devices don't need images bigger than their viewport. It's recommended to have multiple versions of one image on different sizes.
⁃ Create different image sizes for the devices you want to target. ⁃ Use
pictureto deliver multiple variants of each image.
⁃ Use the tools suggested below to minify your files automatically before or during your build or your deployment.
<head>or at the end of your page (before
<body>can slow down your page because it loads while the DOM is being built. The best option is to use external files with
deferto avoid blocking the DOM. Another option is to place some scripts inside your
<head>. Most of the time analytics code or small script that need to load before the DOM gets to main processing.
Ensure that all your files are loaded using
deferand decide wisely the code that you will need to inject in your
asyncor deferred using
<!-- Defer Attribute --> <script defer src="foo.js"></script> <!-- Async Attribute --> <script async src="foo.js"></script>
<script>tag (particularly is inside the
<head>), it stops to fetch and run it. Adding
deferare highly recommended if your scripts are placed in the top of your page but less valuable if just before your
</body>tag. But it's a good practice to always use these attributes to avoid any performance issue.
async(if the script don't rely on other scripts) or
defer(if the script relies upon or relied upon by an async script) as an attribute to your script tag. ⁃ If you have small scripts, maybe use inline script place above async scripts.
Most of the time, new versions come with optimization and security fix. You should use the most optimized code to speed up your project and ensure that you'll not slow down your website or app without outdated plugin.
If your project use NPM packages, npm-check is a pretty interesting library to upgrade / update your libraries. Greenkeeper can automatically look for your dependencies and suggest an update every time a new version is out.
Check dependencies size limit: ![low] Ensure to use wisely external libraries, most of the time, you can use a lighter library for a same functionality.
You may be tempted to use one of the 745 000 packages you can find on npm, but you need to choose the best package for your needs. For example, MomentJS is an awesome library but with a lot of methods you may never use, that's why Day.js was created. It's just 2kB vs 16.4kB gz for Moment.
Always compare and choose the best and lighter library for your needs. You can also use tools like npm trends to compare NPM package downloads counts or Bundlephobia to know the size of your dependencies.
Use the Timeline tool in the Chrome Developer Tool to evaluate scripts events and found the one that may take too much time.
- 📖 How to Record Heap Snapshots | Tools for Web Developers | Google Developers
- 📖 Chapter 22 - Profiling the Frontend - Blackfire
Use of Service Workers: ![medium] You are using Service Workers in your PWA to cache data or execute possible heavy tasks without impacting the user experience of your application.
Your website is using HTTPS: ![high]
HTTPS is not only for ecommerce websites, but for all websites that are exchanging data. Data shared by a user or data shared to an external entity. Modern browsers today limit functionalities for sites that are not secure. For example: geolocation, push notifications and service workers don't work if your instance is not using HTTPS. And today is much more easy to setup a project with an SSL certificate than it was before (and for free, thanks to Let's Encrypt).
- 📖 Why Use HTTPS? | Cloudflare
- 📖 Enabling HTTPS Without Sacrificing Your Web Performance - Moz
- 📖 How HTTPS Affects Website Performance
- 📖 HTTP versus HTTPS versus HTTP2 - The real story | Tune The Web
- 📖 HTTP vs HTTPS — Test them both yourself
Page weight < 1500 KB (ideally < 500 KB): ![high] Reduce the size of your page + resources as much as you can.
Ideally you should try to target < 500 KB but the state of web shows that the median of Kilobytes is around 1500 KB (even on mobile). Depending on your target users, network connection, devices, it's important to reduce as much as possible your total Kilobytes to have the best user experience possible.
⁃ All the rules inside the Front-End Performance Checklist will help you to reduce as much as possible your resources and your code.
Page load times < 3 seconds: ![high] Reduce as much as possible your page load times to quickly deliver your content to your users.
Faster your website or app is, less you have probability of bounce increases, in other terms you have less chances to lose your user or future client. Enough researches on the subject prove that point.
Time To First Byte < 1.3 seconds: ![high] Reduce as much as you can the time your browser waits before receiving data.
Cookie size: ![medium] If you are using cookies, be sure each cookie doesn't exceed 4096 bytes and your domain name doesn't have more than 20 cookies.
Cookies are exchanged in the HTTP headers between web servers and browsers. It's important to keep the size of cookies as low as possible to minimize the impact on the user's response time.
Eliminate unnecessary cookies.
- Minimizing HTTP requests: ![high] Always ensure that every file requested are essential for your website or application.
- Use a CDN to deliver your assets: ![medium] Use a CDN to deliver faster your content over the world.
- 📖 10 Tips to Optimize CDN Performance - CDN Planet
- 📖 HTTP Caching | Web Fundamentals | Google Developers
Serve files from the same protocol: ![high] Avoid having your website serving files coming from source using HTTP on your website which is using HTTPS for example. If your website is using HTTPS, external files should come from the same protocol.
Serve reachable files: ![high] Avoid requesting unreachable files (404).
- Set HTTP cache headers properly: ![high] Set HTTP headers to avoid expensive number of roundtrips between your browser and the server.
Performances and JS Frameworks
- 📖 Optimizing Performance - React
- 📖 React image manipulation | Cloudinary
- 📖 Debugging React performance with React 16 and Chrome Devtools.
- 📖 Build Performant - React
Performances and CMS
- 📖 19 Tips to Speed Up WordPress Performance (Updated)
- 📖 Speed Up Your WordPress - How to Save Images Optimized for Web
- 🛠 Caching Plugin for WordPress - Speed up your website with WP Rocket
- 🛠 WP-Sweep | WordPress.org
- 🛠 Imagify Image Optimizer | WordPress.org
The Front-End Performance Checklist wants to also be available in other languages! Don't hesitate to submit your contribution!
- 🇵🇹 Portuguese: fernandofawkes/Front-End-Performance-Checklist
- 🇨🇳 Chinese: JohnsenZhou/Front-End-Performance-Checklist
- 🇷🇺 Russian: lex111/Front-End-Performance-Checklist
- 🇫🇷 French: WilliamDASILVA/Front-End-Performance-Checklist
- 🇰🇷 Korean: ParkSB/Front-End-Performance-Checklist
- 🇪🇸 Spanish: dagerzuga/Front-End-Performance-Checklist
- 🇻🇮 Vietnamese : huynhan147/Front-End-Performance-Checklist
- 🇯🇵 Japanese: GameWith/Front-End-Performance-Checklist
- 🇵🇱 Polish: mbiesiad/Front-End-Performance-Checklist