2026-08-30 · 5 min read · Rahul Chitturi
- base64
- api
- performance
Base64 expands binary data by roughly one third before JSON quoting, headers, and protocol framing are added. A file below an upload limit can therefore produce a request that a browser, proxy, function runtime, or API rejects.
Failures may appear as HTTP 413, truncated JSON, high memory use, or a decoder error near the end of an incomplete string.
Measure every representation
Record the original byte count, encoded character count, complete request size, and configured limit at every hop. Do not estimate from the visible filename or an operating system's rounded size.
- Expect four encoded characters for each three input bytes
- Include data URL prefixes and JSON property overhead
- Check whether limits use decimal or binary units
- Verify padding and transport wrapping after truncation
Choose an appropriate transport
Small binary values may fit comfortably in JSON, but large files are usually better sent as multipart data or uploaded directly to object storage with bounded authorization. Streaming avoids holding multiple expanded copies in memory.
Apply limits before encoding on clients and after decoding on servers. Validate media type and content independently from a client-provided extension.
A Flashman workflow
Use the Base64 tool with a synthetic sample, the units converter to compare limits, the JSON formatter to measure the full wrapper, and the hash tool to confirm that a decoded round trip preserved bytes.
Test just below, at, and above each effective limit, including multibyte metadata and the deployment gateway used in production.