Base64 Encoded Size Calculator
Estimate how large your data becomes after Base64 encoding, accounting for padding, optional line wrapping, and data-URI prefixes.
Unit
Line wrapping (76 chars)
Data-URI prefix
Approx. 1.33 MB
- 1
Input size in bytes
1 × 1,048,576 = 1,048,576 - 2
Base64 encoded length
4 × ceil(1,048,576 ÷ 3) = 1,398,104Every 3 bytes produce 4 Base64 characters; "=" padding rounds up to a multiple of 4.
How does this calculator work?
Base64 turns every 3 bytes into 4 characters, so encoded size = 4 × ceil(bytes / 3), about 33% larger than the original. Small inputs show extra overhead from "=" padding. Optional MIME line wrapping adds 2 bytes per 76 characters, and a data-URI prefix adds a fixed header of roughly 37 bytes.
Formula
How this is calculated
Enter the original (unencoded) data size and pick a unit; the value is converted to raw bytes n = value × unitBytes (1 KB = 1024 B). Base64 encodes every 3 input bytes into 4 output characters, so the encoded length is 4 × ceil(n / 3). The ceil and trailing "=" padding ensure the output length is always a multiple of 4, which is why tiny inputs show more than 33% overhead.
The theoretical overhead is (4/3 − 1) = 33.3%; for large n the overhead% = (encoded / n − 1) × 100 converges to about 33.3%. If line wrapping is enabled, a CRLF (2 bytes) is inserted after every 76 characters, adding 2 × floor(encoded / 76) bytes — the convention used by MIME/PEM. If a data-URI prefix is selected, a fixed prefix such as "data:application/octet-stream;base64," (about 37 bytes) is prepended.
Assumptions: standard Base64 with "=" padding, byte counts (not characters), and binary 1024-based units. The data-URI prefix length varies with the actual MIME type, so treat that component as an estimate. Encoding never reduces size, so the result is always larger than the input.
Frequently asked questions
Base64 rounds output up to a multiple of 4 characters using "=" padding, so very small inputs carry proportionally more padding. As the input grows, the overhead approaches the theoretical ~33.3%.
It adds 2 bytes (CRLF) for every 76 encoded characters, roughly a 2.6% increase on top of the encoded payload. It is required by some formats like MIME and PEM.
The prefix length depends on the MIME type string (e.g. "data:image/png;base64,"). This tool uses a representative ~37-byte prefix, so adjust expectations for shorter or longer MIME types.
Also known as
TG we-Calculate Editorial Team. (2026). Base64 Encoded Size Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/base64-size-calculator
TG we-Calculate Editorial Team. "Base64 Encoded Size Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/base64-size-calculator.
TG we-Calculate Editorial Team, "Base64 Encoded Size Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/base64-size-calculator
@misc{wecalculate_base64_size_calculator, title = {Base64 Encoded Size Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/base64-size-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
