Skip to content
Private: files never leave your device

Base64 Size Increase: Table and Formula

How much bigger a file, image or string becomes when it is Base64 encoded, worked out from the rules in the RFCs: the exact formula, a lookup table from 1 byte to 25 MB, and the extra characters added by padding, data URL prefixes and email line breaks.

Base64 turns every 3 bytes into 4 characters, an increase of about 33.3 percent, so a 1 MiB file becomes 1,398,104 characters, and email adds 2 bytes of line break for every 76 characters

Base64 encoding makes data about 33.3 percent larger, because every 3 bytes of input become 4 characters of output. The exact encoded length of n bytes is 4 x ceil(n / 3) characters, so a 1 MiB file (1,048,576 bytes) becomes 1,398,104 characters. Each character is stored as 1 byte in ASCII or UTF-8, so characters and bytes are the same number here. Every figure below was calculated from RFC 4648, RFC 2045 and RFC 2397, checked on 24 November 2026.

The formula and where it comes from

RFC 4648 section 4 describes Base64 as taking 24-bit groups of input, three 8-bit bytes, and splitting each group into four 6-bit values, each written as one character from a 64-character alphabet. Four characters for three bytes is a ratio of 4 / 3, or 1.3333.

When the input length is not a multiple of 3, RFC 4648 still completes a full four-character unit at the end. If the last group holds one byte, the output ends in two characters and ==; if it holds two bytes, three characters and =. That padding is why small inputs grow far more than a third.

MeasureFormulaExample for 100 bytes
Standard Base64 with padding4 x ceil(n / 3)136 characters
Without padding (allowed only where the spec using it says so)ceil(4n / 3)134 characters
Padding characters0 if n mod 3 is 0, 2 if 1, 1 if 22 (100 mod 3 is 1)
MIME email body, 76 character linesBase64 length + 2 x (lines - 1)138 bytes
Data URLprefix length + Base64 length22 + 136 = 158 for a PNG
Largest input that fits L charactersfloor(L / 4) x 31,000,000 characters fit 750,000 bytes

Encoded size lookup table

Sizes in the first column are exact bytes. KiB and MiB mean 1,024 and 1,048,576 bytes; the 1,000 byte row shows the decimal kilobyte.

Original sizeBase64 charactersPaddingWith 76 char MIME linesSize ratio
1 byte4==44.00 x
2 bytes4=42.00 x
3 bytes4none41.33 x
10 bytes16==161.60 x
100 bytes136==1381.36 x
1,000 bytes (1 KB)1,336==1,3701.336 x
1,024 bytes (1 KiB)1,368==1,4021.336 x
10 KiB (10,240 bytes)13,656==14,0141.3336 x
100 KiB (102,400 bytes)136,536==140,1281.3334 x
1 MiB (1,048,576 bytes)1,398,104==1,434,8961.3333 x
5 MiB (5,242,880 bytes)6,990,508=7,174,4681.3333 x
10 MiB (10,485,760 bytes)13,981,016==14,348,9361.3333 x
25 MiB (26,214,400 bytes)34,952,536==35,872,3381.3333 x

The MIME column assumes CRLF between lines and none after the last line; add 2 more bytes if your encoder ends with a line break. To check one of these rows yourself, encode a file with the Base64 Encode / Decode tool and compare the output length.

Extra characters from data URL prefixes

RFC 2397 defines the data URL as data:[<mediatype>][;base64],<data>, and notes the scheme is only useful for short values. The prefix adds a fixed number of characters on top of the Base64 length.

PrefixCharacters
data:image/png;base64,22
data:image/gif;base64,22
data:image/jpeg;base64,23
data:image/webp;base64,23
data:font/woff2;base64,23
data:image/svg+xml;base64,26
data:application/pdf;base64,28

For a 30 KB PNG icon the prefix hardly matters, but the third added by Base64 does: inlining the image adds roughly 10 KB to your HTML or CSS. Shrinking the image first with Compress Image cuts the encoded size by the same proportion.

Line breaks in email and PEM

RFC 2045 requires the Base64 body of a MIME email to be written in lines of no more than 76 characters, not counting the CRLF line ending. That adds 2 bytes for every 76 characters, so encoded email attachments grow by about 36.8 percent instead of 33.3 percent. RFC 4648 notes that PEM uses 64 character lines, which works out at about 37.5 percent, and that encoders must not add line breaks unless the specification using Base64 asks for them.

Base64url

RFC 4648 section 5 defines a URL and filename safe alphabet, base64url, which uses - and _ in place of + and /. The size is the same, but RFC 4648 notes padding may be skipped when the length is known, as JSON Web Tokens do, which saves up to 2 characters.

Sources and dates

SourceCheckedUsed for
RFC 4648: The Base16, Base32, and Base64 Data Encodings24 November 202624-bit groups, padding cases, line feed rule, PEM 64 characters, base64url
RFC 2045: MIME Part One24 November 202676 character line limit, not counting CRLF
RFC 2397: The data URL scheme24 November 2026Data URL syntax

Frequently asked questions

How much does Base64 increase file size?

By about 33.3 percent, because RFC 4648 turns every 3 bytes into 4 characters. Small inputs grow more because of padding, and email attachments grow about 36.8 percent once line breaks are added.

How big is a 1 MB file in Base64?

A 1,000,000 byte file becomes 1,333,336 characters. A 1 MiB file of 1,048,576 bytes becomes 1,398,104 characters, or 1,434,896 bytes in an email with 76 character lines.

Why does Base64 end with = or ==?

The equals signs are padding. RFC 4648 completes a 4 character unit at the end, adding == when the last group has 1 byte and = when it has 2.

How do I work out the original size from a Base64 string?

Take the length without line breaks, multiply by 3, divide by 4, then subtract the number of = signs at the end.