How to download a base64 image in JavaScript

When you are dealing with the content of an image file. You may receive base64 image content in string format. So today we will show you how to download base64 image in JavaScript.

Let’s assume that you have base64 image string base64-image-string that we have to download in image form using JavaScript.

Download base64 image

Here, we have created the a tag and set the href & download attributes. Then immediately call the click event to download the file.

You can use the above function to download any file such as jpeg, text, etc.

I hope you find this article helpful.
Thank you for reading. Happy Coding..!! 🙂

If you found value in this article,
you can support us by buying me a coffee! ☕

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *