Lets suppose I have an image called - myImage.png
and I'm using it with the <img>
tag or as a background-image
it doesn't really matter:
<img src="myImage.png" />
So I decide to convert it as a base 64 image:
.myImage {
background: 0 no-repeat;
background-image: url(data:image/jpeg;base64,/9j/4AA...SOV//2Q==);
}
The normal size of the image as a .png file, is for example - 60KB
.
Then if I create a .css file, paste the chunk of code mentioned above from .myImage
and save it, after saving the file its size will be - 60KB
as well.
Now my logic is, both images will have the same performance and the same server response because both have the same size, but I'm starting having my doubts and would like to know if does the base 64 image will actually be faster, more lightweight and have a better performance.