Base64 Size Calculator
Calculate the encoded size and overhead of Base64 data.
What the Base64 Size Calculator does
Base64 represents binary data using 64 printable characters, encoding three bytes as four characters. That ratio is fixed, so the encoded form is always about a third larger — the price of surviving transport channels that only handle text.
Formula
Encoded bytes = 4 × ⌈raw bytes ÷ 3⌉Raw bytes ≈ encoded bytes × 3 ÷ 4Overhead = 33.33% before paddingPadding = (3 − raw mod 3) mod 3 "=" characters
Inputs explained
| Input | Unit | Required | Notes |
|---|---|---|---|
| Calculate | one of 2 options | Yes | — |
| Size | number | Yes | Accepts more than 0. |
| Size unit | one of 9 options | Yes | — |
| Data URI prefix length | number | Optional | Characters such as "data:image/png;base64," — that one is 22. Accepts 0 or more. |
How to use it
- Choose Calculate and Size unit.
- Enter Size.
- Optionally add Data URI prefix length.
- Select Calculate.
Worked example
Encoding a 1 MB file as Base64.
- Direction
- Encode
- Size
- 1 MB
1,000,000 bytes is 333,334 three-byte groups, so 1,333,336 encoded characters — 333,336 extra bytes, a 33.33% overhead with two padding characters.
Frequently asked questions
Why is Base64 exactly a third bigger?
It maps every 3 bytes (24 bits) to 4 six-bit characters. 4 ÷ 3 = 1.333, so the overhead is fixed at 33.3% regardless of content.
Should I inline images as data URIs?
Only for very small assets. You save a request but pay 33% more bytes, lose separate caching, and block the parent file from streaming.