> Let’s begin by the base64 notation. The cardinality of each byte is 64 so it takes 3 bytes in base64 to represent 2 bytes of actual value. Wait, what? I thought it takes 4 base-64 digits to represent 3 bytes of data. Not 3 base-64 digits to represent 2 bytes of data.
4 * 6 = 24 = 8 * 3
So, you're correct... the exact amount of bytes that it takes to represent "actual" bytes goes like this: Actual bytes | b64 bytes required | overhead
1 | 2 | 2x
2 | 3 | 1.5x
3 | 4 | 1.33x
4 | 6 | 1.5x
5 | 7 | 1.4x
6 | 8 | 1.33x
7 | 10 | 1.43x
8 | 11 | 1.37x
9 | 12 | 1.33x
EDIT: As you can see, this averages with an overhead of between 33% (best case scenario where the encoding requires no padding, happens every 3 rows above) and something like 37%, decreasing with the number of bytes being encoded and approaching the minimum, 33% (e.g. to encode 1024 bytes, you need 1366 b64 digits, an overhead of 1.333984375x).