File Size Unit Converter (MB / MiB / GB / GiB)
Instantly convert byte counts between KB, KiB, MB, MiB, GB, GiB. For boundary-value testing and upload-limit calculation.
—
—
—
—
—
—
—
—
Other Tools
Related articles
📖 Where people get stuck
Converts between B, KB, KiB, MB, MiB, GB and GiB. It shows the decimal (SI) and binary interpretations side by side, so you can check which of the two a given number was written in. Everything runs in the browser. What this tool cannot know is which of the two the "500MB" in front of you means — the notation alone does not settle it, and you have to know the convention of the software that wrote it. Most trouble around capacity is not arithmetic; it is a disagreement about which megabyte is meant.
| Case | What happens | What to do |
|---|---|---|
| The same "GB" can differ by more than 7 percent | 1 GB is 1,000,000,000 bytes and 1 GiB is 1,073,741,824 bytes, a difference of 7.4 percent. The gap widens with each step up the prefixes, reaching about 10 percent between TB and TiB. The problem is that a lot of software computes in binary while labelling the result GB — Windows Explorer does exactly this, showing a 1 GiB file as 1 GB. Drive manufacturers and macOS, meanwhile, use the decimal definition. So "I bought a 500GB drive and only have 465GB" is not a mislabelling — it is simply that 500,000,000,000 bytes, recounted in binary units, comes to 465.7 GiB. | In specifications, requirements and API documentation, write the byte count rather than a unit. max_upload = 10485760 cannot be misread, whereas "up to 10MB" becomes 10,000,000 for one reader and 10,485,760 for another. There is a way to tell which an existing number is: divide it by 1024 a few times, and if you land on a clean integer it was binary (4194304 is 4 MiB). Conversely, a tail of zeros means decimal. On the command line, the raw byte count from ls -l and stat is the only unambiguous answer, and the moment you add -h rounding enters the picture — when you are reconciling numbers, always compare raw byte counts. |
| The upload limit is not the file size | Deciding on "up to 10MB" does not mean the request that reaches your server is 10MB. multipart/form-data adds boundaries and headers, and a design that sends the file as Base64 (embedded in a JSON API, for instance) inflates it by 33 percent — a 10MB file becomes 13.3MB. On top of that, the limit exists at several layers rather than one, and the smallest value wins: client_max_body_size in nginx, upload_max_filesize and post_max_size in PHP, your own validation, and the ceilings of a load balancer or CDN. What makes it awkward is that each layer fails differently — exceed the nginx limit and you get a 413; exceed the PHP one and you get a 200 with an empty $_FILES, which is the hardest kind of breakage to diagnose, because nothing appears to happen. |
Decide all four values together, from one policy. The rule of thumb is client_max_body_size at least post_max_size, at least upload_max_filesize, at least the size you actually allow, with 20 to 30 percent of headroom between the steps — to allow 10MB, something like upload_max_filesize=10M, post_max_size=12M, client_max_body_size=16M. For large files, align the time limits too: raising only one of max_execution_time and the nginx fastcgi_read_timeout still leaves you cut off by whichever is shorter. And derive the limit from twice your largest expected use case, then record in a comment why that number was chosen — a value with no stated basis is one nobody after you can change safely. |
| Space used on disk differs from the reported size | A filesystem allocates space in blocks, so even a one-byte file occupies 4 KiB on most default configurations. For one file that is rounding error, but with ten thousand small files, what should be 100KB in total is using 40MB — that is why the numbers never add up in a cache directory or in node_modules. The discrepancy also runs the other way: sparse files, such as a large but mostly empty disk image, occupy less than their reported size, and filesystem compression or deduplication shrinks them further still. In other words, the word "size" refers to two different quantities. |
Measure the two numbers separately. On Linux and macOS, du -sh --apparent-size gives the total of the file contents and du -sh gives the total of the blocks actually occupied. A directory where those two differ sharply is one holding a great many small files, and it is approaching not only a full disk but an inode exhaustion (check with df -i — if writes fail while there is plenty of free space, this is usually why). When estimating for backups or container images, use the content total rather than the occupied total — transfer volume and archive size scale with content, not with block allocation. |
Which meaning a prefix takes depends on the domain. Three pairings are worth memorizing. Memory is always binary — "8GB of RAM" is invariably 8 GiB, because the address lines are physically a power of two. Storage as advertised is decimal. And network bandwidth is in bits, and decimal as well — "1Gbps" is 125 MB/s, dividing by eight to go from bits to bytes. Getting 12MB/s on a 100Mbps line is normal. Note also that bits and bytes are distinguished only by the case of b versus B — that single character is a factor of eight, so when you write documentation, spell out Mbps or MB/s rather than abbreviating. Finally, KB has historically often meant 1024, and the KiB notation was introduced in 1998 precisely to resolve that — use KiB and MiB in new documents, and assume either meaning is possible when reading old ones.
📖 How to Use
-
1
Enter a value and unitEnter a number in the input field and select the unit (B / KB / KiB / MB / MiB / GB / GiB) from the dropdown.
-
2
Check all converted valuesConverted values for B, KB, KiB, MB, MiB, GB, GiB, and TB are shown at once. Handy for boundary testing or upload limit design.
-
3
Verify the difference between SI (MB) and binary (MiB)1 MB = 1,000,000 B; 1 MiB = 1,048,576 B. Use this when the unit in your OS differs from the spec.
❓ Frequently Asked Questions
What is the difference between MB and MiB?
Why does my OS show a different GB than the spec?
How many bytes in 1 GB?
🐛 Found a bug or issue with this tool?
Free to use, no signup. Even just the steps to reproduce are helpful. Reports go directly to the operator and help us fix issues.
Thanks for your report!
Your report has been delivered to the operator and will be used to improve the tool.