










Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Base 64 encoding is a binary-to-text encoding scheme used to represent binary data as an ASCII string. what Base 64 encoding is, why it's used, and the encoding algorithm. Learn how to manually encode strings like 'BUET' to Base64 (QlVFVA) and perform Base 64 encoding operations for various strings such as 'Web', 'CSE', 'India', 'Bangladesh', 'eee', and 'learning'.
Typology: Slides
1 / 18
This page cannot be seen from the preview
Don't miss anything!











In programming, Base64 is a group of binary-to-text encoding schemes that represent
binary data (more specifically, a sequence of 8-bit bytes) in an ASCII string format by
translating the data into a radix-64 representation. The term Base64 originates from a
specific MIME content transfer encoding. Each non-final 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.
Base 64 Encoding takes a stream of characters and converts them to characters that belong
to the universal ASCII character set. Once a stream of characters has been converted to
characters that belong to the universal ASCII character set (Base 64 encoded) they can be
transported with ease over the Internet using the e-mail protocols.
From our example we got,
Hex representation of text 4D 61 72 79 20 68 61 64
Bit representation of text grouped by
bytes
Bit representation of text in groups
of 6 bits
Decimal representation of text in
groups of 6 bits
Base 64 encoded string. TWFyeSBoYWQ=
Step:
First, we need to split the string letter by letter. Thus, necessary groups.
Step:
Next we need to convert each group to binary.
To do this, for each letter we need to find the corresponding binary value in
the ASCII table. After that, we have some groups of ones and zeros.
Step:
Now concatenate all the binary values together (that is, glue all the groups along
and make sure we get a total of
(Number of Groups*8) characters).
Step:
Then, divide the resulting string into groups so that each one has 6 characters (if
the last group has less than 6 characters, we need to fill it with zeros until it
reaches the desired length). Well and good.
Step:
At this step we have to convert six-bit bytes into eight-bit bytes. To do this,
prepend the prefix “00” (two zeros) in front of each group.
Step:
There we have to convert each group from binary to decimal by finding its
corresponding decimal value in the ASCII table. If we did everything right, each
group will be transformed into its integer number.
Step:
First, we need to split the string letter by letter. Thus, we got groups.
Step:
Next we need to convert each group to binary.
To do this, for each letter we need to find the corresponding binary value in
the ASCII table. Now, we have 4 groups of ones and zeros.
Step:
At this step we have to convert six-bit bytes into eight-bit bytes. To do this,
prepend the prefix “00” (two zeros) in front of each group.
00010000
00000000
Step:
There we have to convert each group from binary to decimal by finding its
corresponding decimal value in the ASCII table. If we did everything right, each
group will be transformed into its integer number as follows.
Step:
The final chord, concatenate all letters to get the Base64 string: QlVFVA
To summarize, we learned that encoding “BUET” to Base64 yields the result
“QlVFVA”. As we can see, this is a very simple process and you can encode text
to Base64 even by hand. I hope that you managed to get the right encoding
result.