Web Tools

Import Cost Estimator

All tools

Paste the top of a file and see roughly what its imports weigh.

How it works

Four simple steps

1

Paste import lines

Use import, require(), import() or plain package names.

2

Packages are matched

Each line is reduced to a package name and looked up.

3

Unknowns are flagged

Local paths and unlisted packages are marked, not guessed.

4

Read the total

Known packages add up to an approximate gzip figure.

Import Cost Estimator

About Import Cost Estimator

You are reviewing a pull request that adds three new imports to a route component, and you want a quick sense of whether any of them is heavy. Copying the import block into this estimator gives a rough kilobyte figure per package without checking out the branch or running a build.

Each line is read on its own. The tool recognizes ES module imports with a from clause, require() calls, dynamic import() calls and bare package names, then trims deep paths back to the package, so "lodash/debounce" counts as lodash while scoped names keep their scope. Sizes come from a small offline table of 17 common packages, including react, react-dom, lodash, axios, moment, dayjs, vue, rxjs, chart.js, d3, zod and date-fns. Relative or absolute paths are labeled as local files, and anything missing from the table is marked unknown instead of being given a guessed number.

Two habits keep the total honest. Every line is counted, so if the same package appears twice it is added twice; remove duplicates before reading the sum. Side-effect imports such as import "./styles.css" have no from clause and show up as unknown entries, which you can ignore. Cherry-picked paths are priced as the whole package, so the result overstates code that imports one helper. For a bigger catalogue with budgets and alternatives, open the npm bundle size comparison, and tidy a messy snippet first with the JavaScript formatter.

Lines are matched with regular expressions in the page itself, so your source code stays on your machine.

Keyboard shortcut

Ctrl Enter - Run tool
FAQ

Frequently asked questions

See all FAQs

Answers for this tool. For site-wide help, open the FAQ hub.

The offline table only covers 17 widely used packages. Anything else is listed without a size so the total never includes a made-up number. Add those packages to the Bundle Size Estimator custom list with your own measurement.

A line like import type { User } from "zod" is still matched by its from clause, so a package in the table gets priced even though type imports add nothing at runtime. Delete type-only lines before reading the total.

No. It is a sum of rounded gzip sizes for whole packages. Tree shaking, shared dependencies and code splitting all change the real number, so confirm with your bundler's analyzer before making a decision.

View more FAQs

Related tools

View all

A11y Annotator

Audit HTML for alt text, labels, headings, and ARIA gaps with fix suggestions.

Open

Bundle Size Estimator

Compare approximate gzip sizes for popular npm packages offline.

Open

URL Parser

Break down any URL into parts.

Open

URL Builder

Build URLs with query params.

Open

Explore 321 free tools

Everything you need as a developer, marketer or creator - in one beautiful place.

Browse all tools