Runs in your browser ยท nothing uploaded
  1. Home
  2. Guides
  3. Can my browser do Top-Level Await?
Browser

Can my browser do Top-Level Await?

Check if your browser supports Top-Level Await, recently fully enabled in WebKit for Safari 27.

By DeviceInfo Editorial Team October 23, 2026 2 min read

Illustration for the guide: Can my browser do Top-Level Await?

Short answer

Top-Level Await allows you to use the await keyword outside of async functions in ES modules. It is now fully supported in WebKit (Safari 27) and major browsers, meaning your code can handle asynchronous initialization directly at the module root level without wrapping it in an async IIFE or main() function.

Why it matters

Before Top-Level Await, developers had to wrap module-level initialization in asynchronous functions. This feature simplifies syntax and allows native top-level asynchronous code in ES modules. WebKit recently addressed previous inconsistencies, ensuring Safari now matches the spec compliance of other major engines.

How to test support

You can verify support by checking if your browser executes top-level await in a module context. Most modern browsers support this. However, older WebKit versions or non-module contexts (like classic scripts) will fail. Always ensure your code is served as an ES module (type="module") for this to work.

Browser support status

  • Safari 27: Full spec compliance achieved.
  • Chromium/Firefox: Supported for several versions.
  • Older Browsers: May require polyfills or transpilation.
FeatureSafari 27Chromium
Top-Level AwaitYesYes
ES Module ContextRequiredRequired

Try it live

See your browser's actual capabilities here: JavaScript Test. Also, explore how devices are detected in What is User Agent? and How to Check Device Type.

Source

WebKit Blog: Fixing Top-Level Await in Safari

Frequently asked questions

Does Top-Level Await work in classic scripts?

No, it only works within ES modules (files loaded with type="module").

Did Safari previously support this?

Earlier versions had incomplete or inconsistent implementation; Safari 27 fixes this to match the WebKit spec.

Is it safe for production?

Yes, for browsers supporting ES modules and async/await. It does not change execution model, only syntax convenience.

Your device, your values

See this on your own browser right now

Keep reading