Base64 Payload Size

Developer utilities

How Base64 Payload Size works

Calculate the length and expansion of standard padded Base64 for a binary payload without reading the file.

Group bytes in threes

Standard padded Base64 emits four characters for every three source bytes or partial three-byte group. The exact encoded length is 4 × ceil(bytes ÷ 3).

Count additional text

Base64 symbols occupy one byte each in UTF-8. Include any ASCII prefix separately, such as a known data URL prefix.

Know what is excluded

This is a size estimator, not an encoder. It excludes line wrapping, JSON escaping, compression, transport headers and multipart overhead. Unpadded variants can be shorter.

Worked example

A 1,024-byte payload becomes 1,368 Base64 characters with standard padding. Adding a 22-byte ASCII prefix produces a 1,390-byte string.

Try the calculator

About the method

This tool uses the stated arithmetic and assumptions. Test the worked example and confirm the inputs before using the result.