Why do we have Base64 encoding? I am a beginner and I really don't understand why would you obfuscate the bytes into something else (unless it is encryption). In one of the books I read Base64 encoding is useful when binary transmission is not possible. Eg. When we post a form it is encoded. But why do we convert bytes into letters? Couldn't we just convert bytes into string format with a space in between? For example, 00000001 00000004
? Or simply 0000000100000004
without any space because bytes always come in pair of 8?
The real purpose of Base64 encoding
base64encoding
Related Topic
- Html – Embedding Base64 Images
- Json – Binary Data in JSON String. Something better than Base64
- Why does base64 encoding require padding if the input length is not divisible by 3
- Node.js – How to do Base64 encoding in Node.js
- Why does a base64 encoded string have an = sign at the end
- Html – How to display Base64 images in HTML
- C# – How to encode and decode a base64 string
Best Answer
Base64 is a way to encode binary data into an ASCII character set known to pretty much every computer system, in order to transmit the data without loss or modification of the contents itself. For example, mail systems cannot deal with binary data because they expect ASCII (textual) data. So if you want to transfer an image or another file, it will get corrupted because of the way it deals with the data.
Note: base64 encoding is NOT a way of encrypting, nor a way of compacting data. In fact a base64 encoded piece of data is 1.333… times bigger than the original datapiece. It is only a way to be sure that no data is lost or modified during the transfer.