Skip to content
Omnikalc

Data encoding overhead calculator: how much bigger Base64, hex and other encodings make your data

Enter the size of your data and choose Base64, Base64 MIME, Base32, hex, Base85 or percent-encoding to get the exact encoded size, the overhead in percent, the extra bytes and the extra transfer time.

Updated on
Your inputs
bytes

Value out of range

Mbps

Value out of range

Results

Size of the encoded data

1,333,336 bytes

Overhead
33.33 %
Moderate overhead: avoid for large files
Extra bytes
333,336 bytes
Encoded size in MiB
1.272 MiB
Extra transfer time because of the encoding
0.0267 s

Binary data must often be turned into text, and the text is bigger. The data encoding overhead calculator gives the exact size of your data after Base64, Base64 MIME, Base32, hexadecimal, Base85 or percent-encoding, with the overhead and the extra transfer time.

How the calculation works

  • Enter the size of the original data in bytes and choose the encoding: Base64, Base64 MIME, Base32, hexadecimal, Base85 or percent-encoding.
  • Enter the speed of the connection in Mbps to estimate the extra time of the transfer.
  • The calculator uses the exact rule of each encoding: for example, Base64 turns each group of 3 bytes into 4 characters, with padding, so the size is 4 × ceil(n / 3).
  • The result is the size of the encoded data, the overhead in percent, the extra bytes and the extra time.

Example

A file of 1,000,000 bytes encoded in Base64 becomes 4 × ceil(1,000,000 / 3) = 1,333,336 bytes, which is 1.272 MiB. The overhead is 33.34 %, or 333,336 extra bytes. On a 100 Mbps link, the extra data takes 0.0267 s to send. With hexadecimal encoding, the size would double.

Why it matters

The calculator helps developers, system administrators and anyone who sends files in JSON, e-mail or a data URI to estimate the size of a payload, the cost of bandwidth and storage, and the limits of an API that accepts a given number of characters.

Good to know

The sizes are computed from the rules of the encodings, with the padding of the standard. Some libraries omit the padding or add line breaks differently, so the real size can differ by a few bytes. The transfer time is only the time for the extra bytes at the speed you enter, and it ignores the protocol overhead and the compression. The percent-encoding value is the worst case: ordinary text is much smaller.

The Ethernet overhead calculator covers the overhead of the frames, the download time calculator turns a size and a speed into a duration, the hash collision calculator covers hashes, and the cloud storage cost calculator prices the storage of the data.

Frequently asked questions

Why does Base64 add 33 % to the size?

Base64 represents 3 bytes (24 bits) with 4 characters of 6 bits each. Each character is sent as one byte, so the size grows by 4/3, which is 33.3 %. The output is padded with = signs to a multiple of 4 characters, so the exact size is 4 × ceil(n/3). It is used to put binary data in text formats such as JSON, XML, e-mail, data URIs and HTTP headers.

What is the difference with Base64 MIME?

The MIME variant (RFC 2045) cuts the output in lines of at most 76 characters, with a CRLF at the end of each line. It adds 2 bytes for each 76 characters, about 2.6 % on top of the 33 %, for a total of about 36.8 %. E-mail attachments use it. The other variants, such as URL-safe Base64, have the same size as the standard one unless the padding is removed.

How do the other encodings compare?

Hexadecimal uses 2 characters for each byte (+100 %), Base32 uses 8 characters for 5 bytes (+60 %), Base64 uses 4 for 3 (+33 %) and Base85 uses 5 for 4 (+25 %). Percent-encoding of every byte (%XX) is +200 % in the worst case, but for ordinary text only the special characters are encoded. A more compact encoding needs a larger alphabet, which is not always safe in the context.

When should I avoid these encodings?

For large files, a binary transfer such as multipart upload or a binary protocol is better: it saves a third of the bandwidth and the CPU time for encoding and decoding. Embedding images as Base64 in HTML or CSS saves a request but increases the size by a third, and it cannot be cached separately. Compression such as gzip reduces part of the overhead for text, but not for data that are already compressed.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.