Base64 Size Calculator

Find the Base64-encoded size of data.

Result

1,336 bytes
33.60%

How it is calculated

Base64 turns every group of 3 input bytes (24 bits) into 4 output characters of 6 bits each. If the input is not a multiple of 3, the last group is padded with = characters, so the output is always a multiple of 4. The tool applies encoded = ceil(n ÷ 3) × 4, where n is the original size in bytes, and overhead = (encoded − n) ÷ n × 100. A fractional input is rounded to a whole number of bytes, a negative number gives no result, and 0 gives 0 bytes and 0% overhead. The figure counts the padded output with no line breaks. It does not add the extra newline characters that some formats such as MIME insert into long Base64 text, and it does not include a data URI prefix.

Worked example

You want to embed a file of 1000 bytes in a JSON field as Base64. Step 1: 1000 ÷ 3 = 333.33, and rounding up gives 334 groups. Step 2: 334 × 4 = 1,336 bytes encoded. Step 3: overhead = (1336 − 1000) ÷ 1000 × 100 = 33.60%. Of the 1,336 characters, the final group carries 1 data byte plus padding. For a large file the overhead settles near one third, since 4 characters carry 3 bytes.

Try this example →

Common mistakes

  • Entering the size in kilobytes or megabytes. The field takes bytes, so a 2 KB file is 2048 bytes (or 2000, depending on how you count a kilobyte).
  • Expecting an exact 33% increase on small inputs. Padding dominates: a single byte becomes 4 characters, an overhead of 300%.
  • Forgetting that some systems add line breaks (for example every 76 characters) or a data:image/png;base64, prefix, which make the real text longer than this figure.
  • Applying the result to the length of the text you typed rather than the size of the binary data before encoding.

About this calculator

This calculator finds the encoded output size when data is converted to Base64, using ceil(n/3)×4 bytes for n input bytes, since Base64 encoding groups every 3 raw bytes (24 bits) into 4 encoded characters (6 bits each, from a 64-character alphabet) — padding with = characters when the input isn't a multiple of 3. This structure explains why Base64 output is always roughly 33% larger than the original binary data.

Web developers embedding images or files as data URIs, API developers estimating payload size when binary data (like file uploads or authentication tokens) must travel through JSON or XML, and backend engineers sizing database columns or message queue limits for encoded content use this. Enter the original data size to get the encoded size and overhead.

Was this helpful?

You can pick up to 3 reactions.

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators