Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the advantage of using Base64 encoding?

Tags:

base64

What is the advantage of using Base64 encode?

I would like to understand it better. Do I really need it? Can't I simply use pure strings?

I heard that the encoding can be up to 30% larger than the original (at least for images).

like image 568
Ismael Avatar asked Nov 05 '09 19:11

Ismael


People also ask

Where is Base64 encoding used?

From wiki: “Base64 encoding schemes are commonly used when there is a need to encode binary data that needs be stored and transferred over media that are designed to deal with textual data. This is to ensure that the data remains intact without modification during transport”.

Why use Base64 instead of binary?

Also, textual media may reject certain binary values as non-text. Base64 encoding encodes binary data as values that can only be interpreted as text in textual media, and is free of any special characters and/or control characters, so that the data will be preserved across textual media as well.

How efficient is Base64 encoding?

Although Base64 is a relatively efficient way of encoding binary data it will, on average still increase the file size for more than 25%. This not only increases your bandwidth bill, but also increases the download time.

Why is Base64 the most compact?

Whereas Decimal is even less efficient: each byte of data would be represented as three numbers, which means that each byte of unencoded data would take up three bytes as encoded data. Base64 maps every three bytes of data into four bytes of encoded data.


1 Answers

Originally some protocols only allowed 7 bit, and sometimes only 6 bit, data.

Base64 allows one to encode 8 bit data into 6 bits for transmission on those types of links.

Email is an example of this.

like image 189
Adam Davis Avatar answered Sep 26 '22 07:09

Adam Davis