Promise.all(promises) takes a list of promises and returns one new promise. It fulfills when every promise has fulfilled, with an array of their values in input order, no matter which finished first. If any promise rejects, the result rejects at once with that first rejection. Plain values in the list count as already fulfilled, and an empty list gives [].
Remember
Promise.all([a, b, c]) -> one promise
all fulfill -> [valueA, valueB, valueC] (input order)
one rejects -> rejects with the FIRST error (fail fast)
plain value -> treated as already fulfilled
[] -> fulfills with []
Syntax
Call it on Promise with an array (or any iterable) of promises.
Start one task per item, then wait for all of them.
A static method, part of JavaScript since ES2015. It does not start any work; the tasks are already running when you pass their promises.
Library declarations
JavaScript
Promise.all(iterable) // returns a Promise
// fulfills with: an array of values, same order as iterable
// rejects with: the reason of the first promise that rejects
Parameters
Parameter
Description
iterable
An array (or other iterable) of promises. Non-promise values are wrapped with Promise.resolve(), so [1, p] works.
Return Value
Return Value
Description
Promise
Fulfills with an array of all values in input order, or rejects with the first rejection reason.
JavaScript Examples
Example 1 — Load Three Things at Once
A page often needs several pieces of data. Here setTimeout stands in for three network requests that finish at different times.
waiting...
finished: posts
finished: settings
finished: user
["user","posts","settings"]
How It Works
All three timers start together. Each wait() call starts its timer immediately, so the total wait is about 90 ms, the slowest task, not 180 ms. The synchronous waiting... line prints first.
They finish in their own order. posts (30 ms) finishes first, then settings, then user. Promise.all keeps waiting until the last one is done.
The array keeps input order. The values come back as user, posts, settings: the order of the array you passed in, not the order the tasks finished.
Example 2 — One Failure Rejects Everything
Task B fails. Watch when catch() runs, and notice that task C still finishes afterwards.
A fulfills, B rejects. At 30 ms A succeeds. At 60 ms B calls reject() with its own error message.
The result rejects immediately.Promise.all does not wait for C. Its promise rejects with B's error, so then is skipped and catch prints caught: B failed.
C is not cancelled. C's timer still fires at 120 ms and logs C done, but its value goes nowhere. A promise cannot stop work that has already started.
Example 3 — With await, map(), and Edge Cases
The most common real pattern is await Promise.all(list.map(...)). This example also shows plain values and an empty list.
map() starts every lookup.cart.map(getPrice) returns an array of three promises that are all pending at the same time, and await pauses main until all of them fulfill.
Use the array like any other. After the await, prices is a normal array, so reduce() adds it up to 10.
Plain values and empty lists. The numbers and strings in mixed pass straight through. An empty list fulfills with [] instead of waiting forever.
Compatibility
Browser & Runtime Support
Promise.all() is part of ES2015 (ES6), together with the Promise object itself.
✓ Baseline · ES2015
Promise.all()
Supported in every modern browser, plus Node.js, Deno, and Bun. Internet Explorer has no promises at all.
BaselineEvery modern browser
Google ChromeAll modern versions
Full support
Mozilla FirefoxAll modern versions
Full support
Apple SafariAll modern versions
Full support
Microsoft EdgeAll modern versions
Full support
Node.jsAll current releases
Supported
DenoAll releases
Supported
Internet ExplorerNo native support
Not supported
Promise.all()Excellent
Bottom line: Safe everywhere you can use promises. For a report of every result instead of fail-fast behavior, use Promise.allSettled() (ES2020).
Frequently Asked Questions
Promise.all only waits. The tasks run at the same time because they were already started when you created their promises. Promise.all collects the results when they finish.
Always in the order of the input array. The first value belongs to the first promise, even if that promise finished last.
The returned promise rejects immediately with that first rejection reason. The other tasks keep running, but their results are ignored.
A promise that fulfills with an empty array. It does not stay pending.
Use Promise.allSettled when one failure should not hide the other results, for example when you show a report for several independent uploads or checks.