Netlify’s bandwidth pricing can feel like a black box, but understanding a few key mechanics reveals surprisingly simple ways to slash costs and serve your users faster.

Let’s watch a typical Netlify site, my-awesome-site.netlify.app, in action.

Imagine a user requests https://my-awesome-site.netlify.app/index.html. Netlify’s Edge Network receives this. If the index.html file is already cached on an edge server close to the user, Netlify serves it directly from there. This is the fastest and cheapest scenario. If it’s not cached, the edge server fetches it from Netlify’s origin (your deployed site files, typically from an S3 bucket or similar storage). This fetch incurs a cost, and then Netlify caches it on the edge for future requests.

Here’s the breakdown of where costs hit:

  • Bandwidth Out: This is the primary driver. Every byte served from Netlify’s Edge Network to a user counts.
  • Origin Fetch: If an edge server doesn’t have the file, it pulls it from your origin storage. This also consumes bandwidth, often at a different rate than edge-to-user delivery.
  • Cache Invalidation/Stale Cache: If your cache is too short-lived or invalidated frequently, your origin will be hit more often.

The core levers you control are:

  1. Asset Optimization: How efficiently your files are delivered.
  2. Caching Strategy: How long Netlify keeps your files on the edge.
  3. Origin Storage: Where your files are stored and how they’re accessed.

Let’s dive into Asset Optimization.

1. Optimize Images: This is low-hanging fruit. Unoptimized images are huge bandwidth hogs. Netlify’s image optimization service (available on paid plans) transforms images on-the-fly.

  • Diagnosis: Browse your site. Use your browser’s developer tools (Network tab) to inspect image requests. Look for large Content-Length headers for common image formats (.jpg, .png, .gif).
  • Fix: If you’re on a paid plan, ensure you’re using the nfimages transformation. Instead of <img src="/images/logo.png">, use Netlify’s generated URL: <img src="/.netlify/images/v1/my-awesome-site.netlify.app/images/logo.png?w=500&q=75">. This will automatically resize and compress the image. If you’re not on a paid plan, pre-optimize your images using tools like imagemin in your build process.
  • Why it works: Smaller files mean less data transferred, directly reducing bandwidth costs and improving load times.

2. Use Modern Formats: Serve images in formats like WebP or AVIF, which offer better compression than JPEG or PNG.

  • Diagnosis: Similar to above, check image sizes.
  • Fix: Use Netlify’s image optimization with fm=webp or fm=avif: <img src="/.netlify/images/v1/my-awesome-site.netlify.app/images/hero.jpg?w=1000&q=80&fm=webp">. For static delivery, use responsive image tags with <picture>:
    <picture>
      <source srcset="/images/hero.webp" type="image/webp">
      <img src="/images/hero.jpg" alt="Hero Image">
    </picture>
    
    Ensure your build process generates both .webp and the original format.
  • Why it works: More efficient compression codecs reduce file size further.

3. Minify and Compress Assets: CSS, JavaScript, and HTML can often be reduced.

  • Diagnosis: Look at the Content-Length for .css, .js, and .html files in your Network tab. Are they still substantial?
  • Fix: Netlify automatically gzips/brotli compresses most text-based assets served from the edge. Ensure your build process is configured to output minified files. For JavaScript, consider code splitting to only load what’s needed. For CSS, use tools like PurgeCSS to remove unused styles.
  • Why it works: Compression algorithms significantly reduce the size of text-based files.

4. Leverage Browser Caching: Tell browsers and Netlify’s edge servers how long to keep files.

  • Diagnosis: In your Netlify deploy settings, check the "Cache settings" or "CDN configuration." Are your cache headers too short?
  • Fix: For static assets (images, CSS, JS, fonts) that don’t change often, set a long Cache-Control directive. In your netlify.toml:
    [[headers]]
      for = "/*"
      [headers.values]
        "Cache-Control" = "public, max-age=31536000, immutable" # 1 year
    [[headers]]
      for = "/service-worker.js"
      [headers.values]
        "Cache-Control" = "public, max-age=0" # Always revalidate for SW
    
    Use immutable for cache-busting filenames (e.g., app.a1b2c3d4.js).
  • Why it works: When a user revisits your site or requests an asset already in their browser cache or on a nearby edge server, Netlify doesn’t need to serve it again from the origin or even the distant edge, saving bandwidth and time.

5. Analyze your build output: Large static files that aren’t critical can inflate your origin storage and initial deploy size.

  • Diagnosis: After a deploy, check the "Deploy details" page on Netlify. It shows the size of your deployed assets. Are there unexpected large files?
  • Fix: Remove unused assets, large media files (use external hosting like Cloudinary or S3 if they’re not core to the page), or large libraries. If you have a very large node_modules folder, ensure your build process is correctly excluding it from deployment if it’s not needed at runtime.
  • Why it works: Smaller deploy bundles mean faster deploys and less data to manage.

6. Understand Origin Fetch Costs: If your site dynamically fetches data from an API or another source, ensure those requests are efficient.

  • Diagnosis: Use Netlify’s "Functions" logs or your external API logs to see request patterns. Are you fetching the same data repeatedly?
  • Fix: Implement caching on your API responses or use Netlify’s Edge Functions for server-side caching. For static sites, ensure your build process fetches data only once.
  • Why it works: Reduces redundant data transfer from your origin or external services.

The one thing most people don’t realize is that Netlify’s edge caching is incredibly effective, but it’s governed by HTTP cache headers. If your origin (or build process) doesn’t set appropriate Cache-Control headers, Netlify might serve files from the edge for a very short time or even bypass the edge altogether for subsequent requests, leading to unnecessary origin fetches and higher costs. This is especially true if your build process doesn’t use cache-busting filenames.

The next thing you’ll likely encounter is understanding how Netlify Functions and Edge Functions can further optimize your application’s performance and cost by moving logic closer to the user.

Want structured learning?

Take the full Netlify course →