Compress before Base64

Published

Base64 turns binary into text so it can ride in JSON, HTML, CSS or e-mail. The trade-off is well known: every three bytes become four characters—about +33% size. On a fiber desk that may not matter. On a prepaid SIM in Brazil, Nigeria or rural LATAM, uploading a 4K photo “just to convert it” can burn a day’s data quota.

The gap competitors leave open

Most “compress image online” and “gzip online” sites upload your file to a server. That means:

  1. You pay upload bandwidth for the original (often the largest version).
  2. You wait for a round-trip on a slow or metered network.
  3. Private photos and API payloads leave your device.

The useful pattern for expensive-data markets is the opposite: shrink locally first, then encode, share or upload once.

Rule of thumb

Payload Do this first Then
Photos / screenshots Compress image (WebP or JPEG, max width) Image → Base64 or download
JSON / logs / HTML / CSS Gzip compress Base64 only if the API requires text
Already JPEG/PNG/WebP Skip gzip (almost no gain) Optional re-encode at lower quality
Checking a website Gzip test Enable Content-Encoding on the server

Why WebP beats “Base64 of PNG”

A 2 MB PNG becomes ~2.7 MB of Base64. The same photo as WebP at quality 0.8 might be 200–400 KB → ~270–530 KB of Base64. You cut both upload (if you still send it) and API / CDN storage.

Gzip + Base64 for text APIs

For repetitive JSON:

  1. Gzip the UTF-8 bytes in the browser.
  2. Base64 the gzip output if the transport must be text.
  3. On the server: Base64-decode, then gunzip.

Use the size calculator to compare raw Base64 vs gzip-then-Base64 before you ship.

Privacy stays first

Both compressors on this site use browser APIs (Canvas, CompressionStream). Nothing is uploaded for those tools. That matches the same private-by-default model as encode/decode.

Comments (0)

Questions, ideas or a bug in “Compress before Base64”? Leave a comment, rate the tool, or reply to others.

No comments yet. Be the first to share your feedback!

Leave a comment

Rate this tool:
Esc
↑ ↓ move↵ openEsc close