SyntaxStudy
Sign Up
HTML Intermediate 4 min read

The async Attribute

Script async

The async attribute downloads the script in parallel with HTML parsing and executes it as soon as the download completes, pausing parsing briefly.

Execution order is not guaranteed with async — scripts run whenever they finish downloading.

Example
<!-- Downloads and runs immediately when ready — good for analytics -->
<script async src="analytics.js"></script>
<script async src="ads.js"></script>

<!-- These may run in any order depending on download speed -->
Pro Tip

Use async for independent scripts like analytics that do not depend on the DOM or other scripts.