Script loading — defer, async, module
type: TechArticle
description: Choose the right script-loading attribute for every : defer for app code, async for independent third-party, type=module for modern code. Bare in is always wrong.
language: en
is part of: Web Specification Studio
author: Web Specification Studio
publisher: Web Specification Studio
license: https://creativecommons.org/licenses/by/4.0/
date modified: 2026-05-29T09:55:11.000Z
citation: HTML Living Standard — The script element
  type: CreativeWork
  publisher: WHATWG
citation: MDN —
  type: CreativeWork
  publisher: MDN
citation: Chrome for Developers — Eliminate render-blocking resources
  type: CreativeWork
  publisher: Google
citation: web.dev — JavaScript module scripts
  type: CreativeWork
  publisher: web.dev

Web Specification Studio
type: WebSite

Web Specification Studio
type: Organization

breadcrumb
type: BreadcrumbList
item list element: Home
  type: ListItem
  position: 1
  item: https://webspecification.com/
item list element: Spec
  type: ListItem
  position: 2
  item: https://webspecification.com/spec/
item list element: Performance
  type: ListItem
  position: 3
  item: https://webspecification.com/spec/performance/
item list element: Script loading — defer, async, module
  type: ListItem
  position: 4
  item: https://webspecification.com/spec/performance/script-loading/