Skip to main content

BundlePhobia

Free online tool that shows the real minified and gzipped bundle cost of any npm package. Check size over version history, identify tree-shakeable packages, find smaller alternatives, and estimate download times — all before writing a single npm install.

✓ Minified + gzipped size ✓ Version history chart ✓ Tree-shaking detection ✓ Download time estimate ✓ Smaller alternatives ✓ No install needed

What is BundlePhobia?

BundlePhobia is a free public web tool created by Paskal Rao that answers the question every developer should ask before installing a dependency: how much does this package actually cost? You type in any npm package name, and BundlePhobia builds it in isolation, measures the output, and presents a clear breakdown of the minified size, gzipped size, download time on various connection speeds, and whether the package supports tree shaking.

The tool is especially valuable when choosing between competing libraries. A quick search for moment versus date-fns versus dayjs immediately shows that moment ships 18 kB gzipped with no tree shaking, while dayjs delivers the same core API for 2.8 kB. That is the kind of information that should drive dependency decisions, and BundlePhobia surfaces it in seconds without requiring any local setup.

Key Features

How to Use BundlePhobia

# No installation needed — just visit:
# https://bundlephobia.com/

# Search for any npm package by name in the search bar, e.g.:
#   moment
#   lodash
#   date-fns
#   axios
#   react-query

# Or navigate directly to a package result:
# https://bundlephobia.com/package/lodash
# https://bundlephobia.com/package/date-fns
# https://bundlephobia.com/package/[email protected]

# To check a specific version, append @version to the package name in the URL.

Understanding the Results

Each result page shows multiple signals. Understanding what each number means helps you make the right decision about whether to add, replace, or avoid a package.

# Understanding what BundlePhobia shows you

# For each package, BundlePhobia displays:
#
# 1. MINIFIED SIZE — after removing whitespace and comments
#    Example: lodash = 531 kB minified
#
# 2. GZIPPED SIZE — what the browser actually downloads
#    Example: lodash = 71.7 kB gzipped
#
# 3. VERSION HISTORY — a chart of size changes across versions
#    Useful for spotting when a package ballooned in size
#
# 4. DOWNLOAD TIME ESTIMATES — slow 3G / 4G / emerging markets
#    Example: lodash 71 kB = ~1.4 s on slow 3G
#
# 5. SIMILAR PACKAGES — smaller alternatives with size comparison
#    lodash → alternatives: lodash-es, just, remeda, radash
#
# 6. DUPLICATE DETECTION — warns if the package brings in a dependency
#    you already have (e.g. a package bundling its own copy of React)
#
# 7. SIDE EFFECTS FLAG — whether tree shaking can remove unused exports
#    hasSideEffects: false = safe to tree shake
#    hasSideEffects: true  = entire package loads regardless of imports

Practical Example: Choosing a Date Library

BundlePhobia excels at comparative evaluations. Here is a real-world workflow for choosing a date handling library.

# Example workflow: evaluating a date library before adding it as a dependency

# Step 1: Visit bundlephobia.com and search for "moment"
# Result: [email protected] — 72.1 kB (minified) / 18.2 kB (gzip)
# Warning: hasSideEffects: true (cannot tree-shake)
# Shows: download time ~364 ms on slow 3G

# Step 2: Search for alternatives Bundlephobia suggests: "date-fns"
# Result: [email protected] — 2.28 kB for a single import (tree-shakeable!)
# The full package is 500+ kB but you only pay for what you import.

# Step 3: Check "dayjs"
# Result: [email protected] — 6.96 kB (minified) / 2.77 kB (gzip)
# hasSideEffects: false (tree-shakeable)

# Conclusion: moment costs 18.2 kB gzipped on every load.
# date-fns or dayjs are 4-8x smaller for equivalent functionality.

Using the Public API

BundlePhobia exposes a free JSON API for programmatic lookups. Useful for automated dependency audits or custom tooling.

# BundlePhobia also exposes a public JSON API — no API key required.

# Get bundle size info for a package
curl "https://bundlephobia.com/api/size?package=lodash"

# Response (abbreviated):
# {
#   "name": "lodash",
#   "version": "4.17.21",
#   "description": "Lodash modular utilities.",
#   "size": 531614,
#   "gzip": 71655,
#   "dependencyCount": 0,
#   "hasSideEffects": true,
#   "hasJSModule": false,
#   "hasJSNext": false,
#   "isModuleType": false
# }

# Get size for a specific version
curl "https://bundlephobia.com/api/[email protected]"

# Get size history across all versions
curl "https://bundlephobia.com/api/size-history?package=axios"

Editor and Workflow Integrations

Beyond the website, BundlePhobia data is available through editor extensions and can be queried via the API to build custom auditing workflows.

# Using Bundlephobia data in your workflow

# 1. Browser extension (unofficial) — shows package size inline on
#    npmjs.com and github.com package listings

# 2. VS Code extension — bundlephobia-vscode shows import sizes inline
#    in your editor as you type import statements:
#    import { format } from 'date-fns';  // 17 B

# 3. Package.json audit — manually cross-check your top dependencies:
#    cat package.json | grep -E '"[^"]+": "^' | while read line; do
#      pkg=$(echo "$line" | cut -d'"' -f2)
#      echo "Checking: $pkg"
#      curl -s "https://bundlephobia.com/api/size?package=$pkg" |
#        python3 -c "import sys,json; d=json.load(sys.stdin);
#          print(d['name'], d['gzip'], 'bytes gzipped')"
#    done

BundlePhobia vs Size Limit vs Bundlewatch

Feature BundlePhobia Size Limit Bundlewatch
Check npm packagesYesNoNo
Enforce your output sizeNoYesYes
No install / online toolYesNoNo
Version history chartYesNoNo
Suggests alternativesYesNoNo
CI pipeline integrationAPI onlyYes (GitHub Action)Yes

Pros and Cons

Pros

  • ✓ Zero setup — open a browser tab and search, nothing to install
  • ✓ Version history makes it easy to spot when a package grew significantly
  • ✓ Suggests lighter alternatives automatically — great for discovery
  • ✓ Shows real gzip size, not misleading raw file size
  • ✓ Free public API enables custom tooling and automated audits
  • ✓ Tree-shaking flag helps you understand the true cost for your app

Cons

  • ✗ Cannot enforce size budgets on your own output (use Size Limit for that)
  • ✗ Measures full package; actual import cost may be lower for tree-shakeable packages
  • ✗ Occasional cache lag — very new package versions may not appear immediately
  • ✗ No CI blocking capability — it is a research tool, not a gating tool
  • ✗ API has no rate limit documentation; may throttle heavy automated use

Frequently Asked Questions

What is BundlePhobia?▼

BundlePhobia is a free public web tool that lets you look up the bundle size cost of any npm package before installing it. You search for a package by name and BundlePhobia shows you the minified size, gzipped size, download time estimate, version history, whether the package is tree-shakeable, and suggestions for smaller alternatives. It is designed to help developers make informed decisions about which dependencies to add to their projects.

How does BundlePhobia calculate bundle size?▼

BundlePhobia installs the npm package in an isolated environment, bundles it with Webpack using a minimal entry point, applies minification, and then compresses the result with gzip. This gives a realistic estimate of what a browser would download when the package is imported. The result may differ slightly from your real-world bundle because BundlePhobia does not know which parts of the package your app actually uses — for tree-shakeable packages the real cost is usually lower.

Does BundlePhobia support tree shaking?▼

BundlePhobia measures the full package size by default, but it shows a hasSideEffects flag indicating whether the package can be tree-shaken. When hasSideEffects is false, your bundler can eliminate unused exports, so the actual cost in your app may be much smaller than the total package size. For tree-shakeable packages like date-fns, you pay only for the functions you import — BundlePhobia notes this distinction in the results.

Can I use BundlePhobia programmatically?▼

Yes. BundlePhobia exposes a public JSON API at bundlephobia.com/api/size that accepts a package query parameter. You can pass package=lodash or [email protected] for a specific version. The response includes name, version, minified size, gzipped size, dependency count, and the hasSideEffects flag. No API key is required. There is also a size-history endpoint for fetching size trends across all published versions of a package.

What does 'side effects' mean in BundlePhobia?▼

The sideEffects field comes from the package.json of the npm package itself. When a package author sets sideEffects: false, they are declaring that importing from the package will not execute any code with observable side effects (like modifying globals or registering event listeners). This tells bundlers it is safe to remove unused exports through tree shaking. When hasSideEffects is true, the entire package is included in your bundle regardless of which parts you import.

How do I compare packages on BundlePhobia?▼

BundlePhobia automatically suggests similar packages with a size comparison at the bottom of each result page. You can also use the comparison URL format: bundlephobia.com/package/moment,date-fns,dayjs to see all three side by side. The comparison view shows minified and gzipped sizes, download times, and weekly npm download counts so you can balance size against popularity when choosing between alternatives.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →