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.
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
- Minified + gzipped size — reports both the post-minification size and the compressed size that browsers actually download
- Version history — a chart showing how package size has changed across every published version, highlighting when a package bloated
- Tree-shaking flag — shows whether the package declares
sideEffects: false, meaning unused exports can be removed by bundlers - Download time estimates — projected download time on slow 3G, 4G, and other connection profiles for real-world context
- Smaller alternatives — automatically suggests lighter packages with similar functionality for common dependencies
- Duplicate dependency detection — warns if a package bundles a dependency you already have, signaling potential size duplication
- Public JSON API — a free REST endpoint for programmatic size lookups, no API key required
- No install needed — entirely online, works from any browser, nothing to configure locally
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 packages | Yes | No | No |
| Enforce your output size | No | Yes | Yes |
| No install / online tool | Yes | No | No |
| Version history chart | Yes | No | No |
| Suggests alternatives | Yes | No | No |
| CI pipeline integration | API only | Yes (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.
Related Products
on GumroadDeveloper Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →AI Prompt Engineering Toolkit
58 structured prompt templates for Claude, ChatGPT, and Gemini — organized by use case. Code Review, Debugging, Documentation, Architecture, and 10 model-specific tips. Stop writing prompts from scratch.
Buy on Gumroad →Developer Cheat Sheet Bundle
10 print-ready cheat sheets for the tools developers use every day: Git, Docker, Linux CLI, SQL, Regex, HTTP Status codes, VS Code shortcuts, Bash scripting, jq/JSON, and Markdown.
Buy on Gumroad →You Might Also Need
npm Package Stats
Look up npm package weekly download counts, unpacked size, dependency count, latest version, license, and repository link. Live data from the npm registry.
Open free tool →
pnpm Workspace Generator
GUI to configure a pnpm monorepo workspace with package globs, catalog entries, overrides, and options. Generates a ready-to-use pnpm-workspace.yaml file.
Open free tool →
NPM Bundle Size Estimator
Check npm package bundle sizes — minified and gzip. Enter multiple packages at once, see tree-shaking info, and compare sizes side by side.
Open free tool →
More Free Tools
Related Articles
pnpm vs npm vs yarn: Package Manager Performance Benchmark 2026
Real benchmarks comparing pnpm, npm, and yarn in 2026 — install speed, disk usage, monorepo support, lockfile format, and which to choose for your JavaScript project.
npm vs pnpm vs Yarn vs Bun: Best JavaScript Package Manager in 2026
A comprehensive comparison of npm, pnpm, Yarn Classic, Yarn Berry, and Bun package managers. Benchmark data, disk usage, monorepo support, and a recommendation matrix to help you pick the right tool in 2026.
AWS Lambda Cold Start Optimization: 10 Proven Techniques 2026
Eliminate or minimize AWS Lambda cold starts with 10 proven techniques: provisioned concurrency, SnapStart, package minimization, ARM Graviton2, lazy loading, and more with benchmark data.
CDN and Edge Caching 2026: Complete Guide to Content Delivery Networks and Edge Computing
Comprehensive guide to CDN and edge caching strategies for 2026. Covers Cloudflare, Fastly, Akamai, AWS CloudFront, edge functions, cache invalidation, real-time synchronization, and multi-CDN strategies with code examples.
Astro 5 Complete Guide 2026: Content Layer, Server Islands & Performance
Complete Astro 5 guide for 2026: Content Layer API, Server Islands architecture, View Transitions, Actions, performance optimization, and deployment. Build faster websites with less JavaScript.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$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.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →