Base64 in HTML <a>
An <a> element can point to a data URI. Combined with the download attribute, it lets visitors save a file that is embedded in the page.
Example
<a href="data:text/plain;base64,SGVsbG8gV29ybGQ=" download="hello.txt">Download hello.txt</a> Notes
- Browsers block top-level navigation to data: URLs for most types (except downloads and some images), so use download for reliable behaviour.
- For large files, generate a Blob URL with JavaScript instead.
Comments (0)
Questions, ideas or a bug in “Base64 in HTML <a>”? Leave a comment, rate the tool, or reply to others.
No comments yet. Be the first to share your feedback!