HTML <a> download Attribute

The download attribute on an <a> tag changes the URL from a redirect to a download link. Clicking the link will download the resource specified in the href attribute.



A download attribute on an <a> tag.
Clicking the image will download itself.

<a href="/img/html/html5.png" download>
  <img src="/img/html/html5.png" alt="HTML5">

Using download

The <download attribute changes a link into a download link instead of navigational link.

With download enabled, the file referenced by the href attribute will be downloaded directly.

If a string value is provided on the download attribute, it will be used as the downloaded filename.

If not set, the original filename will be used.

Note: Not all browsers support the download attribute.


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



Value Description
filename The name given to the downloaded file, for example, report.pdf.
Note: filename is optional. If not provided the downloaded file name is the href URL value.

Note: An href value is required for download to work.

More Examples

An <a> tag with a download attribute set to AnnualReport.pdf.
Clicking the link will download a pdf report by that name.

<a download="AnnualReport.pdf"
   href="/media/sample.pdf">Download Report</a>

Browser support

Here is when download support started for each browser:

14.0 Jan 2010
20.0 Apr 2013
18.0 Jan 2020
15.0 May 2013
10.1 Mar 2017

You may also like

 Back to <a>