After reading the base64 wiki …
I’m trying to figure out how’s the formula working :
Given a string with length of n
, the base64 length will be
Which is : 4*Math.Ceiling(((double)s.Length/3)))
I already know that base64 length must be %4==0
to allow the decoder know what was the original text length.
The max number of padding for a sequence can be =
or ==
.
wiki :The number of output bytes per input byte is approximately 4 / 3 (33%
overhead)
Question:
How does the information above settle with the output length ?