Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the size limit of a Base64 DataURL image?

I would like to know what is the maximum length of a Base64 DataURL Image to be load in a browser?

Thanks!

like image 327
Pierre Avatar asked Sep 28 '12 09:09

Pierre


People also ask

Does Base64 have a limit?

By default, the body size for base64 encoded data is 7 MB. You could increase the size as required.

How big can a data URI be?

Data URI LimitsChrome - 2MB for the current document. Otherwise the limit is the in-memory storage limit for arbitrary blobs: if x64 and NOT ChromeOS or Android, then 2GB; otherwise, total_physical_memory / 5 (source).

Does converting image to Base64 reduce size?

It will be bigger in base64. Base64 uses 6 bits per byte to encode data, whereas binary uses 8 bits per byte.


2 Answers

Citing MDN on this:

Length limitations

Although Mozilla supports data URIs of essentially unlimited length, browsers are not required to support any particular maximum length of data. For example, the Opera 11 browser limits data URIs to around 65000 characters.

And caniuse.com, where you can also look up the support across browsers:

Support in Internet Explorer 8 is limited to images and linked resources like CSS files, not HTML files. Max URI length in IE8 is 32KB. In IE9 JavaScript files are supported too and the maximum size limit set to 4GB.

like image 172
Sirko Avatar answered Sep 28 '22 03:09

Sirko


Not all browsers support the data URI scheme. IE7 and earlier doesn't support data uri's at all. IE8 has a 32k limit.

http://www.bennadel.com/blog/2002-Creating-Base64-Encoded-Data-URLs-For-Images-In-ColdFusion.htm

like image 35
Apurv Avatar answered Sep 28 '22 03:09

Apurv