Alphabets to Base64 Conversion Table:
Value (Decimal) | Base64 Character |
---|---|
0 | A |
1 | B |
2 | C |
3 | D |
4 | E |
5 | F |
6 | G |
7 | H |
8 | I |
9 | J |
10 | K |
11 | L |
12 | M |
13 | N |
14 | O |
15 | P |
16 | Q |
17 | R |
18 | S |
19 | T |
20 | U |
21 | V |
22 | W |
23 | X |
24 | Y |
25 | Z |
26 | a |
27 | b |
28 | c |
29 | d |
30 | e |
31 | f |
32 | g |
33 | h |
34 | i |
35 | j |
36 | k |
37 | l |
38 | m |
39 | n |
40 | o |
41 | p |
42 | q |
43 | r |
44 | s |
45 | t |
46 | u |
47 | v |
48 | w |
49 | x |
50 | y |
51 | z |
52 | 0 |
53 | 1 |
54 | 2 |
55 | 3 |
56 | 4 |
57 | 5 |
58 | 6 |
59 | 7 |
60 | 8 |
61 | 9 |
62 | + |
63 | / |
ASCII to Base64 Conversion
In Base64 encoding, every three 8-bit ASCII characters (3 bytes = 24 bits) are converted into four 6-bit Base64 characters. Below is an example table for some common text characters and their Base64 equivalents.
Text/Character | ASCII (Binary) | Base64 Chunks | Base64 Characters |
---|---|---|---|
H | 01001000 | 010010 | S |
e | 01100101 | 011001 | Z |
l | 01101100 | 011011 | b |
l | 01101100 | 011011 | b |
o | 01101111 | 011011 | b |
, | 00101100 | 001011 | L |
Space | 00100000 | 001000 | I |
W | 01010111 | 010101 | V |
o | 01101111 | 011011 | b |
r | 01110010 | 011100 | c |
l | 01101100 | 011011 | b |
d | 01100100 | 011001 | Z |
For example, if you encode “Hello, World” in Base64, the result is:
“SGVsbG8sIFdvcmxk”
Explanation:
- H -> Binary:
01001000
, Base64 ->S
- e -> Binary:
01100101
, Base64 ->Z
- l -> Binary:
01101100
, Base64 ->b
- l -> Binary:
01101100
, Base64 ->b
- o -> Binary:
01101111
, Base64 ->b
- , -> Binary:
00101100
, Base64 ->L
- Space -> Binary:
00100000
, Base64 ->I
- W -> Binary:
01010111
, Base64 ->V
- o -> Binary:
01101111
, Base64 ->b
- r -> Binary:
01110010
, Base64 ->c
- l -> Binary:
01101100
, Base64 ->b
- d -> Binary:
01100100
, Base64 ->Z
Padding:
If the input data length isn’t divisible by 3, Base64 uses padding characters =
to ensure the output length is always a multiple of 4.
For example, “Man” is encoded as “TWFu” without padding because it fits perfectly into three 8-bit ASCII characters, but “Ma” would be “TWE=” (with padding).