0%

What is Base64?

Well, as the name suggests, it expresses many things with a radix-64 number system.

In computer science, Base64 is a group of binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding. Each Base64 digit represents exactly 6 bits of data. Three 8-bit bytes (i.e., a total of 24 bits) can therefore be represented by four 6-bit Base64 digits.

Specs

Base64 can encode/decode basically any kind of MIME type, text/plain being the most common, but many others are also possible, such as text/html or application/pdf. Base64 turns these data into a long string of alphanumeric characters. For example, “Hello World!” encoded into Base64 would be SGVsbG8gV29ybGQhCg==.

Note: The result may vary due to different versions of Base64. All of the results in this post are from the RFC 4648 version.

Applications

  • encode binary files such as images within scripts, to avoid depending on external files
  • represent file contents instead of being supplied in external files (e.g. CSS)
  • represent information in URLs which cannot contain special characters
  • replace lengthy pieces of information in URLS
  • confuse other people by sending them files as Base64

To be continued