HTML download Attribute


The HTML download attribute is a feature designed for use within <a> (anchor) tags to instruct the browser to download the target of the link instead of navigating to it. This attribute is particularly useful when linking to resources that should be saved directly to the user's device, such as PDF documents, image files, or other multimedia content.

When the download attribute is present, the browser will download the resource linked by the <a> tag's href attribute, rather than navigating to it. Optionally, the download attribute can be assigned a value, which will be used as the default filename for the saved resource, giving web developers control over the naming of downloaded files.

This attribute enhances user experience and control, providing a straightforward way to distribute downloadable content directly through hyperlinks. It's important to note, however, that the download attribute only works for same-origin URLs, unless the resource being downloaded is a blob object or a data URI, thereby respecting the security considerations of modern web browsers.


<tagname href="URL" download="filename" />


  • filenameThe name given to the downloaded file, for example, sunset.jpg. Note: filename is optional. If not provided the downloaded file name is the href URL value.

Applies To

The download attribute can be used on the following html elements.


<a href="images/sunset.jpg" download="sunset.jpg">Download Image</a>

Browser Support

The following table will show you the current browser support for the HTML download Attribute.

Edge Chrome Firefox Opera Safari
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview

Last updated by CSSPortal on: 29th March 2024