Details & the Inspector

How to see how much bigger Base64 makes a file on a Mac

You can do this with B64 in the Inspector. Here is the number, where it comes from, and what to do when it is too big.

Base64 always costs. Three bytes become four characters, so the result is about 33% larger than the file — plus a little more if you wrap the lines. That is a rule of thumb; the Inspector gives you the actual figure for the actual file.

Read the numbers

  1. Encode the file

    Load it in Encode (⌘1).

  2. Open the Inspector

    ⌥⌘I. Three rows matter: the source Size, the Characters in the result, and the Overhead as a percentage.

  3. Compare against the limit

    If the destination has a field limit or a message size cap, the character count is the number to check it against.

Where the 33 per cent comes from

The encoding takes three bytes at a time — 24 bits — and writes them as four six-bit characters. Four out for every three in is a ratio of 4/3, or about 133% of the original length. Padding adds up to two characters at the very end, and line wrapping adds a byte or two per line.

Typical results
SourceBase64Wrapped at 76
100 kB≈ 133 kB≈ 135 kB
1 MB≈ 1,33 MB≈ 1,35 MB
1,8 MB photo≈ 2,4 MB≈ 2,43 MB
18 MB scanned PDF≈ 24 MB≈ 24,3 MB
Wrapping is nearly free

At 76 columns the line breaks add roughly 1,3% on top. It is not the reason a payload is too big for anything.

When the number is too big

There is no setting in the encoding to change — the output length is a fixed function of the input length. Every lever is upstream, on the file itself:

  • Crop. On a screenshot this is by far the biggest saving available.
  • Resize. An asset displayed at 120 pixels does not need to be 2 000 pixels wide.
  • Re-compress. A more heavily compressed JPEG, or a PNG with a reduced palette.
  • Choose a different format. A photographic image saved as PNG is much larger than the same picture as JPEG.
  • Do not embed it. Sometimes the answer is that this one should stay a file.

The cost that is not in the number

An embedded asset is downloaded with every copy of the document that holds it, and cannot be cached separately. Embedding one logo across forty pages downloads it forty times. The 33% is the visible cost; the repetition is often the larger one.

Which is the whole argument for the rule of thumb that keeps coming up: embed the small things that must not go missing, and leave the big things as files.

Troubleshooting

The overhead is more than 33 per cent

Line wrapping, or a very small file where the padding is a larger share of the total. Both are expected.

My payload was rejected for being too long

Compare the character count with the limit. Then work on the source file — there is nothing in the encoding to tune.

The character count and the byte size disagree

They measure different things. Base64 output is ASCII, so one character is one byte, but the size shown includes line breaks where wrapping is on.

Frequently asked questions

How much bigger does Base64 make a file?

About 33 per cent — four characters out for every three bytes in — plus roughly 1,3 per cent more if you wrap at 76 columns. The Inspector shows the exact figure for your file.

Can I make the Base64 smaller?

Not in the encoding — the output length is a fixed function of the input length. Every lever is on the source file: crop it, resize it, re-compress it, or leave it as a file.

Does line wrapping make a real difference to size?

No. At 76 columns it adds around 1,3 per cent. It is never the reason a payload is too big.

Why is the overhead more than 33 per cent on a tiny file?

Padding is a larger share of a very short result. On anything of normal size it is negligible.