⚙️ Base64 Algorithm
Encoding Steps
1. Take 3 bytes (24 bits) of input at a time.
2. Split into 4 groups of 6 bits each.
3. Map each 6-bit value to the Base64 alphabet (A=0, B=1 ... +=62, /=63).
4. If input is not divisible by 3, pad with = characters.
Visual Example
Input bytes: M a n Binary: 01001101 01100001 01101110 Groups of 6: 010011 010110 000101 101110 Decimal: 19 22 5 46 Base64 chars: T W F u Output: TWFu
Padding Rules
1 remaining byte → add ==
2 remaining bytes → add =
Divisible by 3 → no padding