Base64 encoding size calculator
Base64 packs three bytes into four characters, so it costs exactly a third more, plus padding.
Base64 size
133 336B
- Base64 overhead
- 33.336 %
- Hex size
- 200 000
- Base32 size
- 160 000
- Approximate data URI length
- 133 366
- Rough gzipped size
- 100 002
Show the working
- Binary size = 100
- raw = 100 * 1000 = 100 000
- Base64 size = ceil(100 000 / 3) * 4 = 133 336
- Hex size = 100 000 * 2 = 200 000
- Base32 size = ceil(100 000 / 5) * 8 = 160 000
- Base64 overhead = 100 000 > 0 ? (133 336/100 000 - 1) * 100 : 0 = 33.336
- Approximate data URI length = 133 336 + 30 = 133 366
- Rough gzipped size = 133 336 * 0.75 = 100 002
Values are shown to six significant figures here; the arithmetic itself runs on exact fractions and is only rounded where a number is printed.
Scenarios & local history
Compare a saved scenario
Recent calculations
The formula
- Base64: ceil(n/3) x 4 characters
- hex: 2n characters
- Base32: ceil(n/5) x 8 characters
Base64 overhead is exactly 33.3% before padding. Gzip recovers some of it, because Base64 output is highly redundant.