Base64 Image Size Calculator
How big will that Base64 string be? Enter an image size — or drop the actual file — and get the exact data URI length, the ~33% overhead, and a straight verdict: inline it, compress it first, or keep it as a file.
100% client-side. Nothing is measured on a server.
How the calculation works
Base64 rewrites binary data using 64 text characters. Every 3 bytes of input become exactly
4 characters, so the raw encoded length is 4 × ceil(bytes / 3). A full data URI
adds the MIME prefix — data:image/png;base64, is 22 characters — and because every
character is one ASCII byte, the character count is effectively the encoded size in bytes.
| Image size | Raw Base64 | Data URI | Overhead |
|---|---|---|---|
| 1 KB (1,024 B) | 1,368 chars | 1,390 chars ≈ 1.4 KB | +35.7% |
| 5 KB (5,120 B) | 6,828 chars | 6,850 chars ≈ 6.7 KB | +33.8% |
| 10 KB (10,240 B) | 13,656 chars | 13,678 chars ≈ 13.4 KB | +33.6% |
| 50 KB (51,200 B) | 68,268 chars | 68,290 chars ≈ 66.7 KB | +33.4% |
| 500 KB (512,000 B) | 682,668 chars | 682,690 chars ≈ 666.7 KB | +33.3% |
The overhead percentage drifts down toward exactly +33.3% as files get larger; small files carry a slightly higher relative overhead because of the prefix.
The verdict thresholds
- Under 5 KB — good to inline. The HTTP request you save usually outweighs the extra text, especially for icons and small logos.
- 5-50 KB — borderline. Compress first: resizing to display dimensions and re-encoding as WebP often cuts the source by 70-90%, which changes the verdict entirely.
- Over 50 KB — use a file. The browser can cache a normal image independently, lazy-load it, and deliver it via CDN — none of which work for an inline string.
Why the numbers matter more than the rule
Rules of thumb are starting points. HTTP compression (gzip/brotli) claws back some of the Base64 overhead on the wire, but not all of it — and none of it on disk. Reusing the same data URI across many pages repeats the bytes every time, where a hosted file downloads once. Measure, compare, then decide; if the answer is "compress first", the compress + encode tool does both steps in one pass.
More Base64 converters
Frequently asked questions
How much bigger is Base64 than the original file?
About 33% larger: every three bytes become four text characters, plus the ~22-character data URI prefix. A 10 KB image becomes roughly a 13.7 KB data URI.
What is the formula for Base64 encoded size?
Raw Base64 characters = 4 × ceil(bytes / 3). A full data URI adds the MIME prefix (~22 characters for images). Characters are one ASCII byte each, so the count is the encoded byte size.
How big is too big to inline as Base64?
Under 5 KB inlines comfortably; 5-50 KB is worth compressing first; over 50 KB should usually stay a normal, cacheable image file.
Does Gzip reduce the Base64 overhead?
Partially, on the wire only. Base64 text compresses better than random bytes, but the file on disk stays 33% larger and the binary file served directly still wins on transfer size.
Can I reduce the size before encoding?
Yes — that is the only real lever. Resize to display dimensions and re-encode as WebP or JPG. The compressor on this site does both steps in one pass.