JavaScript Bundle Size Estimator
Estimate your JavaScript bundle size before shipping. Add npm packages from a built-in database of 200+ popular libraries to see total gzipped size and load time estimates for 3G, 4G, and WiFi connections — with size warnings and optimization tips.
Frequently Asked Questions
What is gzip bundle size and why does it matter?▼
Gzip size is how large your JavaScript files are after compression during transfer. Modern servers and CDNs compress files automatically — Brotli and gzip can reduce bundle sizes by 60-80%. The gzip size is what affects download time; the uncompressed size affects parse and execution time. Both matter: large uncompressed bundles cause slow JavaScript parsing even on fast connections. Aim for under 200KB gzipped for the initial JS bundle.
What is tree-shaking and which packages support it?▼
Tree-shaking is dead code elimination — bundlers remove exports that aren't imported. It works only with ES module syntax (import/export), not CommonJS (require). Packages that support tree-shaking: date-fns, lodash-es, @radix-ui/react-*, @tanstack/* libraries. Packages that don't: lodash (CJS), moment (very limited). Check if a package has a 'module' field in package.json pointing to .mjs files, which indicates ES module support for tree-shaking.
How do I analyze my actual bundle size in production?▼
For Vite projects: install rollup-plugin-visualizer and add it to vite.config.ts — it generates an interactive treemap. For webpack: use webpack-bundle-analyzer (npx webpack-bundle-analyzer stats.json). For Next.js: add @next/bundle-analyzer to next.config.js. For a quick online check: use bundlejs.com or bundlephobia.com to see exact gzipped size of any npm package. Use import cost VS Code extension to see sizes inline while coding.
What are the biggest bundle size mistakes?▼
Most common: (1) Importing entire lodash (import _ from 'lodash') instead of individual functions. (2) Using moment.js — 72KB gzipped; replace with dayjs (2.4KB) or date-fns (tree-shakeable). (3) Loading all of D3 when only using a few modules. (4) Not splitting routes — all pages load at startup. (5) Including polyfills for modern browsers that don't need them. (6) Development dependencies in production bundles.
What is code splitting and how do I implement it?▼
Code splitting defers non-critical JavaScript until it's needed, reducing initial bundle size. In React: use React.lazy() + Suspense for route-level or component-level splitting. In Next.js: dynamic() from next/dynamic. In Vite: import('./module') creates automatic split points. Split by route (most impactful), by feature (load on demand), or by user interaction (load after first interaction). Target under 50KB per route chunk for optimal performance.
How does JavaScript bundle size affect mobile users?▼
Mobile users face a triple penalty: (1) slower download on cellular networks, (2) slower JavaScript parsing — mid-range Android parses JS ~3-4x slower than desktop, (3) slower execution due to CPU throttling. A 500KB gzipped bundle takes ~2.4s to parse on a mid-range phone. The rule of thumb: keep total JS under 200KB gzipped on mobile, under 500KB for desktop-first apps. Use Chrome DevTools' device throttling to simulate real mobile performance.
Related Products
on GumroadTypeScript Quick Reference Toolkit
5 practical reference files for TypeScript developers: cheatsheet, TS vs JS comparison, 20 utility types with real examples, tsconfig best practices template, and 15 common mistakes guide. Print it. Keep it on your desk.
Buy on Gumroad →DevToolkit Starter Kit
A ready-to-deploy developer tools website with 12 built-in tools. Astro + Preact + Tailwind. Deploy to Cloudflare Pages for free. Built-in SEO, dark mode, and ad-ready layout.
Buy on Gumroad →Developer 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 →You Might Also Need
Vitest Configuration Generator
Generate a complete vitest.config.ts visually. Configure test environment (node/jsdom/happy-dom), coverage provider, reporters, thresholds, and path aliases.
Open free tool →
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 →
More Free Tools
Related Articles
Vite 6 vs Webpack 5 深度對決:2026 大型專案遷移實戰指南
2026 年最完整的 Vite 6 vs Webpack 5 深度比較與遷移指南。涵蓋效能基準測試、分塊策略、CSS Modules、環境變數轉換、常見陷阱與真實大型專案遷移清單。
Performance Optimization 2026: Complete Guide to Frontend, Backend, and Infrastructure
Comprehensive performance optimization guide for 2026 covering Core Web Vitals, JavaScript bundle optimization, server-side rendering, caching strategies, database query optimization, CDN configuration, and real-world benchmarks.
Vite 6 vs webpack vs esbuild vs Turbopack: Build Tool Comparison 2026
In-depth 2026 comparison of JavaScript build tools: Vite 6, webpack 5, esbuild, and Turbopack. Build speeds, HMR, plugin ecosystems, migration paths, and when to use each.
Vite 6 vs Webpack 5 vs Turbopack: Which Bundler Wins in 2026?
A detailed comparison of Vite 6, Webpack 5, and Turbopack build performance, HMR speed, configuration complexity, and production output. Includes real benchmark data and a decision guide for 2026.
Vite vs Webpack vs Turbopack vs esbuild: Build Tool Comparison 2026
Compare Vite, Webpack, Turbopack, and esbuild on cold start, HMR speed, bundle size, and ecosystem fit. Includes benchmarks, config examples, and migration guides for 2026.
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 →