HTML Attributes

HTML <script> async Attribute

The async attribute lets an external script download in parallel and run as soon as it is ready.


The <script> async Attribute

async is a boolean attribute for the <script> element. It applies only to external scripts (those with a src). When present, the browser downloads the script in the background without pausing HTML parsing, then executes it immediately once the download finishes, which may interrupt parsing at that moment.

Syntax

ℹ️

Syntax: <script src="file.js" async></script>. Being boolean, async takes no value and is either present or absent. It has no effect on inline scripts.

Load an analytics script asynchronously
<script src="https://example.com/analytics.js" async></script>
ValueDescription
asyncDownload in parallel; execute as soon as ready, order not guaranteed
deferDownload in parallel; execute after parsing, in document order
(neither)Download and execute immediately, blocking HTML parsing
⚠️

async scripts can run in any order and may execute before the DOM is fully parsed. Use async for independent scripts like analytics; use defer when execution order or a fully parsed DOM matters.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships