HTML download Attribute

The download attribute on a link type element changes the URL from a redirect to a download link. Elements that accept this attribute include <a>, and <area>.



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">

For additional details see our HTML a download Reference.

Using download

The download attribute turns 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.


<tagname 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.

Elements that accept download

The following image-related elements accept the download attribute.

Elements Description
<a> Specifies an anchor link -- see example above
<area> Creates a clickable area inside an image map.

<area> with download

Three <area> tags with a download attribute.
Click on any of the areas and an image file will download.

<img src="/img/html/computer-map.png" alt="Computer" usemap="#computermap">

<map name="computermap">
  <area download shape="rect" coords="253,142,16,2" href="/img/html/area-monitor.png">
  <area download shape="rect" coords="262,218,0,156" href="/img/html/area-keyboard.png">
  <area download shape="circle" coords="267,234,22" href="/img/html/area-mouse.png">

For additional details see our HTML area download Reference.

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