Measure the encoded length and byte size of inputs with quick local calculation.
base64 不可缩短,仅作长度估算。
| Item | Formula / Rule | Source / Standard |
|---|---|---|
| Encoded length | L = 4 × ⌈n / 3⌉ where n is the input byte count | RFC 4648 §4 Base 64 Encoding |
| Padding | Padding = (3 − n mod 3) mod 3 "=" characters, rounding up to a multiple of four | RFC 4648 §3.2 Padding of Encoded Data |
| Size overhead | Overhead = 4/3 − 1 ≈ 33.3%, since every three bytes become four characters | RFC 4648 §4, 6-bit group mapping |