Skip to main content
core-js is the most widely used JavaScript polyfill library. It provides modular polyfills for ECMAScript features from ES5 through ES2025, TC39 stage proposals, and select Web/WHATWG APIs — letting you use modern JavaScript everywhere, without waiting for runtime support.

Installation

Install core-js and its companion packages via npm, yarn, or pnpm.

Quick Start

Start polyfilling in minutes with a working code example.

Entry Points

Learn how to import only the features you need.

Babel Integration

Automate polyfill injection with @babel/preset-env and @babel/runtime.

What is core-js?

core-js is a modular standard library for JavaScript. It includes polyfills for:
  • ECMAScript up to ES2025 — Promise, Symbol, Map, Set, Iterator, TypedArrays, Array methods, String methods, Object methods, and hundreds more
  • TC39 proposals — from finished proposals (already in the language) down through Stage 0 experiments
  • Web standards — URL, URLSearchParams, structuredClone, queueMicrotask, setImmediate, DOMException, and iterable DOM collections
You can load the entire library, or import only the specific features your code uses — keeping bundle sizes small and avoiding unnecessary overhead.
1

Install the package

npm install --save core-js@3
2

Import features you need

// All stable ES + Web + Stage 3 proposals:
import 'core-js/actual';

// Or import just what you use:
import 'core-js/actual/promise';
import 'core-js/actual/array/flat-map';
import 'core-js/actual/set';
3

Write modern JavaScript everywhere

Promise.try(() => 42).then(it => console.log(it)); // => 42

[1, 2].flatMap(it => [it, it]); // => [1, 1, 2, 2]

Array.from(new Set([1, 2, 3]).union(new Set([3, 4, 5]))); // => [1, 2, 3, 4, 5]

Choose your package

core-js

The global polyfill — patches built-in prototypes and constructors directly. Best for application code.

core-js-pure

Pollution-free variant — exports standalone functions without touching globals. Best for library authors.

core-js-compat

Compatibility data — get a list of required core-js modules for any browserslist target.

core-js-builder

Custom build — generate a targeted bundle with only the polyfills your environments need.

Explore the API

ECMAScript builtins

Object, Array, String, Number, Math, Date, Function, Error

Collections

Map, Set, WeakMap, WeakSet, WeakRef

Iterators

Iterator helpers, AsyncIterator, for-of support

Typed Arrays

Int8Array, Uint8Array, Float32Array, and all TypedArray methods

Promise

Promise, Promise.all, Promise.allSettled, Promise.any, Promise.try

Web Standards

URL, structuredClone, queueMicrotask, setImmediate, DOMException