Interactive roadmap

    Frontend Performance Best Practices roadmap

    Designed for web developers who want to make websites load faster and feel smoother for every user.

    Your progress0% · 0 of 15 topics
    Done Learning Skipped OptionalClick any topic to learn more and mark your progress.
    1. 1

      Measure Website Speed

      0 of 3 done

      Learn how to track loading speed and user experience metrics.

      Always measure your site before making changes so you can actually prove your updates worked.
    2. 2

      Optimise Images and Media

      0 of 3 done

      Make heavy visual assets load much faster.

      Images usually make up the heaviest part of a webpage, so shrinking them gives you the biggest speed boost.
    3. 3

      Streamline JavaScript Code

      0 of 3 done

      Reduce script sizes so pages become interactive quicker.

      Send only the JavaScript your browser needs right now, and let the rest wait.
    4. 4

      Speed Up Fonts and CSS

      0 of 3 done

      Ensure text appears instantly without layout jumps.

      Keep your text readable and your layouts stable while custom styles and fonts load.
    5. 5

      Caching and Network Delivery

      0 of 3 done

      Deliver files faster using global servers and smart caching.

      Save network trips by storing static files closer to your users and letting browsers remember them.

    Learn it all, with a tutor that never sleeps

    Every topic links to LevelUp lessons, practice exercises and the 24/7 AI Tutor. Your progress updates as you master lessons.

    Every topic explained

    Step 1: Measure Website Speed

    These are official Google metrics that measure loading speed, visual stability, and interactivity so you know how your site performs.
    Read more

    Core Web Vitals are official performance standards created by Google to measure user experience. They focus on three main areas: how fast the main content loads, how stable the page layout stays while loading, and how quickly the page responds when a user clicks something.

    Imagine walking into a shop where the door is stiff, the lights take ages to turn on, and the shelves move as you reach for an item. That is frustrating for customers. These metrics turn that human annoyance into clear numbers.

    Tracking these vitals matters because they directly affect user happiness and search engine rankings. If your site passes these tests, visitors stick around longer and complete more purchases.

    • Measures loading, interactivity, and visual stability
    • Based on real user experience thresholds
    • Influences search engine rankings
    • Identifies specific performance bottlenecks
    Web.dev Performance Guides (Google)
    Built-in browser tools help you record page loads and spot slowdowns on your own computer.
    Read more

    Browser developer tools are built directly into modern web browsers like Chrome, Firefox, and Edge. They let you inspect the inner workings of any web page running on your local machine, acting like a diagnostic machine for developers.

    Think of it like a mechanic plugging a car into a computer to check the engine performance. You can record a page load, look at a timeline of every file being downloaded, and spot which script or image is causing a delay.

    Using these tools is essential because you cannot fix what you cannot see. They allow you to test changes locally and understand exactly how your browser renders your code before publishing it online.

    • Built into all modern web browsers
    • Provides timeline recordings of page loads
    • Helps identify slow network requests
    • Allows testing on simulated mobile devices
    (optional)
    Collecting speed data from actual visitors shows you how the site performs in the real world across different devices.
    Read more

    Real User Monitoring, often called RUM, collects performance data from actual visitors as they browse your live website across different devices, locations, and network speeds. Lab tests only show one controlled environment, but RUM captures the messy reality.

    Picture a restaurant testing recipes in a quiet kitchen versus seeing how hungry diners actually eat them during a busy Friday night rush. Real feedback reveals the hidden issues.

    This data matters because your development laptop is likely much faster than an older phone used by a customer on a patchy bus ride. RUM ensures you solve real problems for real people.

    • Captures data from actual site visitors
    • Accounts for various devices and networks
    • Supplements controlled lab testing
    • Highlights real-world user friction points

    Step 2: Optimise Images and Media

    Newer formats like WebP and AVIF offer much smaller file sizes than traditional JPEG or PNG files without losing quality.
    Read more

    Modern image formats like WebP and AVIF use advanced compression techniques to make file sizes much smaller than older formats like JPEG or PNG. They achieve this without noticeably reducing the visual quality of the picture.

    Imagine packing a suitcase using clever folding techniques to fit twice as many clothes into a smaller bag without crushing your shirts. The contents look the same, but the overall weight drops significantly.

    Switching to these formats is crucial for performance because smaller images download faster over mobile networks. This means your pages appear on screen almost instantly, keeping users engaged from the very first second.

    • Significantly smaller file sizes than JPEG or PNG
    • Maintains high visual quality
    • Supported by all modern web browsers
    • Reduces total page weight
    Send smaller image files to mobile phones and larger ones to desktop screens using simple HTML attributes.
    Read more

    Responsive images mean serving appropriately sized picture files depending on the user's screen. Instead of sending a massive desktop photo to a small smartphone, your HTML markup tells the browser to pick a smaller version.

    Think about buying shoes. You would not wear a size twelve if you are a size seven; you wear the pair that fits your feet properly. Images should fit their display container.

    This approach matters because mobile devices have less processing power and slower data connections. Sending only the pixels needed saves valuable bandwidth and speeds up rendering time.

    • Uses HTML srcset and sizes attributes
    • Prevents mobile devices downloading huge files
    • Improves mobile loading speeds
    • Optimises bandwidth usage
    Stop browsers from downloading images that are hidden below the fold until the user actually scrolls down to them.
    Read more

    Lazy loading is a technique where the browser delays downloading images that are hidden below the fold until the user actually scrolls down the page towards them. Images sitting out of view are simply ignored at first.

    Imagine reading a long magazine article where the publisher only prints the photos for the page you are currently looking at, rather than loading every picture in the entire book at once.

    This matters because it cuts down the initial network traffic required to load a page. By focusing browser resources only on what is immediately visible, the initial page load becomes much faster.

    • Delays loading of offscreen images
    • Triggered when user scrolls near the image
    • Native support using loading equals lazy
    • Reduces initial network congestion

    Step 3: Streamline JavaScript Code

    Break large script files into smaller chunks so users only download the code needed for the current page.
    Read more

    Code splitting involves breaking your massive JavaScript file into smaller, bite-sized chunks. Instead of making the browser download every feature of your application upfront, it only downloads the specific code needed for the current page.

    Picture going to a large department store where you only grab items from the aisle you need, rather than loading a trolley with products from every single department before you step inside.

    This technique is vital because heavy JavaScript blocks the browser from rendering the page and responding to user clicks. Splitting your code makes your site interactive much sooner.

    • Breaks large scripts into smaller chunks
    • Loads code on demand per page
    • Reduces initial download times
    • Improves interactivity scores
    Use specific HTML attributes to stop JavaScript downloads from pausing the display of your web page text.
    Read more

    The defer and async attributes tell the browser how to download and execute JavaScript files in your HTML head. By default, script tags pause all page rendering until the script finishes downloading and running.

    Think of a builder stopping construction on a house frame just to read a delivery manual, blocking everyone else. Defer and async let the delivery happen in the background.

    Using these attributes matters because they stop JavaScript downloads from freezing your text content display. Users can read your articles while scripts load quietly behind the scenes.

    • Prevents scripts from blocking HTML parsing
    • Defer keeps script execution order intact
    • Async runs scripts as soon as they download
    • Speeds up time to first paint
    (optional)
    Clean up your final build files by automatically stripping out any library code your project does not use.
    Read more

    Tree shaking is a build process step that automatically detects and removes unused code from your final JavaScript bundles. If you import a massive helper library but only use one small function, tree shaking strips out the rest.

    Imagine buying a huge tool kit that contains fifty tools, but you only take out the screwdriver you need and leave the rest at the warehouse to save space.

    This practice matters because modern projects rely heavily on open-source libraries that contain code you never actually use. Removing this dead weight keeps your download sizes lean and fast.

    • Removes unused code during the build
    • Relies on modern ES module imports
    • Shrinks final JavaScript bundle sizes
    • Speeds up browser script parsing

    Step 4: Speed Up Fonts and CSS

    Use font display settings to ensure text remains readable while custom web fonts are still downloading.
    Read more

    Font display settings control how a browser behaves while custom web fonts are still downloading over the network. Without proper settings, browsers might hide your text completely or cause sudden layout shifts when the font finally pops in.

    Think of waiting for a sign painter to finish lettering a storefront sign. If the window is blank until they finish, customers walk past. A better way is showing temporary lettering until the custom sign is ready.

    Controlling this matters because users want to read content immediately. Proper font display rules ensure text is visible instantly using a backup font, swapping smoothly when the custom font arrives.

    • Controls browser text rendering during downloads
    • Prevents invisible text layout flickers
    • Uses CSS font-display swap rules
    • Improves perceived loading speed
    Place the styling needed for top-of-page content directly inside the HTML head so the layout appears immediately.
    Read more

    Critical CSS involves extracting the exact styling rules needed to render the top part of your webpage and placing them directly inside the HTML head. This lets the browser style the visible screen instantly without waiting for external stylesheets.

    Imagine dressing the mannequin in the front shop window first so passers-by see an attractive display immediately, while you organise the stockroom at the back.

    This approach matters because it eliminates render-blocking stylesheets that delay the first visual appearance of your site. Users see a styled, polished page layout within milliseconds.

    • Extracts styles for top-of-page content
    • Placed inline inside the HTML head
    • Eliminates render-blocking external stylesheets
    • Speeds up first visual render
    (optional)
    Audit your stylesheets to remove design rules that no longer match your live HTML elements.
    Read more

    Removing unused CSS means auditing your stylesheets to find and delete design rules that no longer match any elements in your live HTML. Over time, projects accumulate leftover styles from old pages and redesigns.

    Think of clearing out your wardrobe to donate clothes you have not worn in years, leaving more space for the items you actually use every day.

    This matters because browsers must download, parse, and evaluate all CSS rules before rendering a page, even if those rules apply to nothing. Trimming the fat keeps style processing lightning fast.

    • Audits stylesheets for dead design rules
    • Reduces CSS file download sizes
    • Lowers browser parsing overhead
    • Keeps project codebases clean

    Step 5: Caching and Network Delivery

    Set response headers so returning visitors load files straight from their local device instead of downloading them again.
    Read more

    HTTP caching tells visitor web browsers to store static files like images, stylesheets, and scripts locally on their hard drive. When they return to your site, their browser loads those files instantly from local storage instead of downloading them again.

    Think of keeping your favourite ingredients in your kitchen pantry rather than walking to the supermarket every single time you want to make a snack.

    Configuring this correctly is essential for returning visitor speed and server load reduction. It turns a sluggish repeat visit into an instantaneous experience while saving bandwidth for everyone.

    • Stores static files on user devices
    • Controlled via server response headers
    • Speeds up repeat page visits
    • Reduces server bandwidth usage
    MDN HTTP Caching Guide
    Store your website files on servers located close to your users geographically to reduce network travel time.
    Read more

    A Content Delivery Network, or CDN, is a global network of servers positioned strategically around the world. Instead of hosting your website files on a single server in one city, a CDN copies your files to servers near your users.

    Imagine opening local branch offices for your bakery across the country so customers can walk down their local street to buy fresh bread, rather than ordering it from the main factory miles away.

    Using a CDN matters because physical distance creates network latency. Bringing your files geographically closer to your audience drastically cuts down travel time and speeds up delivery.

    • Distributes files across global servers
    • Serves content from locations near users
    • Reduces physical network latency
    • Handles traffic spikes efficiently
    (optional)
    Compress text-based files like HTML, CSS, and JavaScript on the server before sending them across the network.
    Read more

    Text compression reduces the file size of text-based assets like HTML, CSS, and JavaScript before they travel across the network. The server zips the files up, and the browser unzips them instantly upon arrival.

    Think of compressing a bulky winter duvet into a vacuum storage bag so it takes up a fraction of the space while travelling in the boot of a car.

    Enabling text compression like Gzip or Brotli matters because smaller files download much faster over the internet, especially for users on slower mobile connections. It is a quick server setting with massive performance gains.

    • Compresses text files before transmission
    • Uses algorithms like Gzip or Brotli
    • Browsers automatically decompress files
    • Significantly reduces transfer times

    Related roadmaps