Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the drawbacks of base64 encoding data?

Tags:

base64

Over the past two years or so, I've base64 encoded multiple types of data for the web: images, .otf files, text, and so on. It's practical in that it serves as a makeshift asset consolidation method (with the data embedded directly in the CSS or HTML, one doesn't have to worry about a dead link), but are there any drawbacks to using this method?

like image 712
Jules Avatar asked Sep 14 '25 10:09

Jules


1 Answers

The base64 encoded data is about 33% larger than the raw data.

Another effect is that you are bundling several pieces of data together into larger chunks. Sometimes this is a positive effect, sometimes negative. Requesting fewer resources is positive, but only if the resources have the same caching status. If you for example bundle an image in an HTML page, the image can't be cached separately as it has to be fetched every time the HTML page is fetched.

like image 189
Guffa Avatar answered Sep 17 '25 19:09

Guffa