Turning an Upload Limit in MB into the Byte Value Your Config Wants
You decided the product should accept a 25 MB attachment. Now that decision has to be written into four or five different places, and half of them refuse to accept the letters "MB". A JavaScript body parser wants a raw integer. An object-storage SDK call wants a part size in bytes. A cloud load balancer field is labelled "bytes" with no suffix offered at all. The number in your head is in megabytes; the number the file needs is a long string of zeroes, and typing one zero too few is how a generous limit silently becomes ten times stricter than anyone intended.
25 × 1 000 000 = 25 000 000 bytes, and a 512 MB bulk-import ceiling is 512 000 000 bytes.Every Hop Has Its Own Ceiling
Suffixes Are Not Portable
25M, some accept digits only, and shorthand suffixes in proxy and runtime configs are 1024-based, so 25M there resolves to 26 214 400 bytes rather than 25 000 000. Writing the byte figure yourself removes the guesswork.The Body Is Bigger Than the File
How to Size an Upload Limit in Bytes
Start From the Product Rule, Not the Config
Decide the number a user would recognise first — "receipts up to 10 MB", "profile photos up to 5 MB". Type that megabyte figure into the left field and read the byte value on the right.
Add Headroom Before You Convert
Convert the padded figure rather than the bare one. If the file cap is 10 MB and the request also carries base64 plus form fields, convert 14 MB instead: 14 000 000 bytes is enough that a legitimate upload never trips the proxy.
Copy the Bare Integer Into the File
The copy button on each field puts the plain number on your clipboard with no unit and no separators, which is exactly what a YAML value, an environment variable or an SDK argument expects. Ctrl+C inside a field does the same thing.
Read an Existing Limit Backwards
Inherited a config full of long integers? Press the swap button, paste the byte value in, and the megabyte equivalent appears — the fastest way to discover that 1048576 in an old manifest is a 1 MiB limit, not the 1 MB somebody assumed when they filed the ticket.
Both fields stay editable in either direction, so you can work from the product requirement down to the config value or from a mystery integer back up to something a ticket can describe in plain language. The searchable dropdowns on both sides also cover kilobytes and gigabytes, which helps when one layer expresses its ceiling in KB and another in GB.
Upload and Request-Size Limits in Bytes
The table lists the megabyte figures that come up most often in upload paths alongside the exact byte integer to paste into a field that will not take a suffix. One caveat worth carrying into the SDK layer: object-storage multipart uploads set their own floor, with every part except the last required to be at least 5 MiB (5 242 880 bytes), so a part size of 5 000 000 bytes is rejected even though it looks like a clean 5 MB.
| Limit in MB | Bytes | Where it usually appears |
|---|---|---|
| 1 MB | 1 000 000 | The starting proxy request body, before anyone raises it |
| 2 MB | 2 000 000 | Classic per-file upload maximum in a stock runtime |
| 5 MB | 5 000 000 | Avatar and profile-image caps |
| 8 MB | 8 000 000 | Classic whole-POST maximum in a stock runtime |
| 25 MB | 25 000 000 | Document and attachment uploads |
| 100 MB | 100 000 000 | Short video clips and CSV imports |
| 512 MB | 512 000 000 | Bulk import endpoints and dataset uploads |
| 1 000 MB | 1 000 000 000 | Chunked or resumable upload ceilings |
Clipboard-Ready Config Values
The copy control returns digits only — no unit, no thousands separators — so pasting straight into a YAML key or a .env line never introduces a character the parser chokes on.
Audit an Inherited Limit
Swap the direction and paste a long integer from an existing manifest to see what the previous owner actually allowed, which is usually the quickest way to explain an unexplained 413 in production.
Switch the Source Unit Mid-Check
Both dropdowns are searchable across the full storage set, so a chunk size quoted in KB and a body limit quoted in GB can be lined up against the same byte scale without leaving the page.
Long Values Stay Countable
Results are grouped with spaces and switch to scientific notation past ten digits, so a nine-zero limit is easy to read back instead of easy to mistype.
Upload Limit Questions Developers Ask
My proxy limit is already 50 MB but uploads still return 413 — what else is capping it?
Almost always another layer on the same path. A location-scoped block with its own smaller value overrides the global one, a cloud load balancer or WAF sitting in front of the proxy may enforce a lower ceiling of its own, and the application runtime has an independent limit that produces a different error page entirely. Convert your intended cap once, then grep every config in the chain for byte values below it, rather than raising one file and redeploying hopefully.
Should the per-file limit and the whole-POST limit be the same number?
No — the POST limit has to be the larger of the two. It covers the entire request body: every file in a multi-file form, all the ordinary text fields, and the multipart boundaries between them. If a form can carry three 10 MB files, the per-file cap is 10 000 000 bytes but the body cap needs to clear 30 000 000 with room to spare, otherwise the runtime discards the request before your validation code ever sees it and the user gets no useful message.
Why does a 5 MB file arrive as a request body of nearly 6.7 MB?
Because it was base64-encoded to travel inside a JSON payload. Base64 turns every 3 bytes into 4 characters, an increase of about 33%, so 5 000 000 bytes becomes roughly 6 666 668 bytes on the wire before JSON escaping and the surrounding object are counted at all. Teams that accept JSON uploads should size the body limit against the encoded figure, or switch to multipart form data and keep the file binary.
What part size should I use for a multipart upload to object storage?
S3-compatible APIs require every part except the final one to be at least 5 MiB (5 242 880 bytes) and allow a maximum of 10 000 parts per object. Those two rules together put a floor under what a given object size can use: convert your chosen part size to bytes and multiply by 10 000 to see the largest object it can still cover. An 8 MB part size handles up to 80 000 000 000 bytes, so anything larger than that needs a bigger part rather than more parts.
Which layers insist on a raw byte integer instead of a friendly suffix?
As a rule, anything that is an API argument rather than a text config file. SDK parameters for chunk and part sizes, request-body middleware options in JavaScript runtimes, gRPC maximum message size settings, and most cloud console fields labelled simply "bytes" all expect a plain number. Text configs for proxies and runtimes usually do accept a suffix, but because that shorthand is 1024-based, writing the explicit byte integer keeps every layer in the chain describing the same actual size.
No comments yet. Be the first to comment!