convert base64 to image in javascript/jquery

You can just create an Image object and put the base64 as its src, including the data:image... part like this:

var image = new Image();
image.src="data:image/png;base64,iVBORw0K...";
document.body.appendChild(image);

It’s what they call “Data URIs” and here’s the compatibility table for inner peace.

Leave a Comment