HTML Download Link Generator
Generate a link that downloads a file rather than opening it, and lets you set the filename the visitor's browser saves it under.
How to use it
- Fill in the fields — the code and the preview update as you type.
- Copy the generated HTML straight into your page.
- The preview renders the real markup, so what you see is what you get.
Examples
| /files/report.pdf | <a href="…" download="report.pdf"> |
By default, clicking a link to a PDF, image or other file the browser knows how to display just opens it in the tab — a PDF fills the window, an image replaces the page. The download attribute changes that: it tells the browser to save the file to disk instead of opening it, and its value sets the filename the visitor's downloads folder ends up with, regardless of what the file was originally called on the server.
That second part matters more than it looks. A file served as /files/a3f9x-report-final-v2.pdf can be handed to the visitor as report.pdf, which is what makes the download attribute genuinely useful for auto-generated or hashed filenames.
The same-origin limit
The download attribute only forces a download for files on the same origin as the page — same scheme, domain and port. Point it at a file on another domain and browsers ignore the attribute for security reasons, falling back to whatever that server's Content-Disposition header says to do, or just opening it inline if there is no such header.
In practice this means the attribute reliably works for files hosted on your own site, and cannot be relied on to force a download of something on a CDN or third-party host you do not control.
Questions people ask
Why does my file open instead of downloading?
The download attribute only works for same-origin files. For a file on another domain the browser ignores it, and the server's Content-Disposition header takes over.
Is anything uploaded?
No. Everything runs in your browser — no file, image or snippet you use here ever leaves your device.
Last updated 22 August 2026