AI Vision Base64 Size Estimator – Free

Enter an image size in bytes and this AI vision size estimator returns the Base64 length, the data URL size and the added overhead, so you can check a request against a payload limit before sending it.

How to use the AI Vision Size Estimator tool

  1. Type the file size into Image size in bytes, or select Example to use 1,024,000 bytes.
  2. Choose PNG, JPEG or WebP under Image format. The format only changes the data URL prefix.
  3. Select Estimate to run the calculation.
  4. Read the four lines in the Result box and select Copy to paste them into a ticket or note.

How Base64 length is calculated from image bytes

Base64 turns every 3 bytes into 4 characters. When the byte count is not a multiple of 3, the last group is filled with = padding, so the output length is always a multiple of 4. The exact length is 4 times the byte count divided by 3, rounded up to a whole group. This tool computes that with integer arithmetic, so the figure is exact and not an approximation.

The data URL line adds the prefix that inline images in vision requests usually need. data:image/png;base64, is 22 characters, and the JPEG and WebP prefixes are 23. Base64 and the prefix are plain ASCII, so the character count equals the byte count once the request is sent as UTF-8.

Worked example: a 1,024,000-byte PNG

A file of 1,024,000 bytes splits into 341,334 groups of three, the last one only partly filled. Multiplying by 4 gives 1,365,336 characters. Adding the 22-character PNG prefix gives 1,365,358 bytes for the data URL. The overhead line shows the 341,336 bytes that encoding added on top of the original file.

Choosing JPEG or WebP for the same size changes only the third line, to 1,365,359.

Image bytes: 1024000
Base64 characters: 1365336
Data URL bytes: 1365358
Base64 overhead: 341336 bytes

What the estimate includes and what it leaves out

The result is a byte count for one image field. Use it as the main term when you budget a request body, then account for the rest of the JSON around it.

  • Included: the Base64 text and the data URL prefix for the selected format.
  • Not included: the model name, prompt text, JSON keys, quotes and HTTP headers.
  • Not included: token usage. Image token cost generally depends on pixel dimensions and the model, not on file size.
  • Not checked: any provider limit. Maximum image and request sizes differ by API, so compare the numbers with current documentation.
  • Input must be a whole number of bytes from 1 up to JavaScript's largest safe integer. Decimals and 0 are rejected.

Reducing a payload that is too large

If the estimate exceeds your limit, the fix is on the image side, because the Base64 overhead is fixed at one third. Resize the image, switch a photographic PNG to JPEG or WebP, or lower the JPEG quality. Each of these cuts the source bytes, and the encoded size falls in proportion. Where an API accepts an image URL or an uploaded file reference, sending that avoids inline encoding altogether.

Frequently asked questions

How much larger is a Base64 image than the original file?

About 33.3% larger, plus up to 2 padding characters. The exact length is 4 characters for every 3 bytes, rounded up to a full group, so a 3,000,000-byte image becomes 4,000,000 characters.

Does the image format change the Base64 size?

Not for the same byte count. Base64 does not care what the bytes mean. The format option only selects the data URL prefix, which is one character longer for JPEG and WebP than for PNG. Format matters earlier, when it decides how many bytes the file has.

Does this tool tell me how many tokens an image costs?

No. It reports bytes and characters only. Vision models usually price images by resolution or tile count, which cannot be derived from file size. Check the pricing rules of the model you call.

Where do I find the image size in bytes?

Take the exact byte count from your file manager's properties dialog, from ls -l on the command line, or from the buffer length in your code. Sizes shown in KB or MB are rounded.

Do I need to upload the image to get an estimate?

No. The tool never sees the image. It works from the number you type, and the calculation runs in your browser.

Related tools