KB vs KiB: Kilobytes, Kibibytes and MB vs MiB
By Niks · Published · Updated
Tested on
- GNU coreutils 8.32 (ls, head, dd, truncate, numfmt) in Git Bash on Windows 11 (10.0.22631)
- Windows PowerShell 5.1
- Run on 29 September 2026
KB vs KiB comes down to one number. A kilobyte (KB) is 1,000 bytes under the SI prefixes, and a kibibyte (KiB) is 1,024 bytes under the IEC binary prefixes. The trouble is that a lot of software writes “KB” or “MB” and means the binary value, so “10 MB” can be 10,000,000 bytes or 10,485,760 bytes depending on who wrote the label. For upload testing, that 485,760-byte gap decides whether a file passes.
This guide gives the exact byte counts, shows what common tools do (with output we captured), and explains which convention this site uses.
KB vs KiB: the exact byte counts
The IEC names are kibi, mebi, gibi and tebi, with symbols Ki, Mi, Gi and Ti. NIST’s page on prefixes for binary multiples lists them, with 1 Kibit equal to 2^10 bit, or 1024 bit. The decimal prefixes are the SI ones.
| Decimal (SI) | Bytes | Binary (IEC) | Bytes | Binary is larger by |
|---|---|---|---|---|
| 1 KB (kilobyte) | 1,000 | 1 KiB (kibibyte) | 1,024 | 2.40% |
| 1 MB (megabyte) | 1,000,000 | 1 MiB (mebibyte) | 1,048,576 | 4.86% |
| 1 GB (gigabyte) | 1,000,000,000 | 1 GiB (gibibyte) | 1,073,741,824 | 7.37% |
| 1 TB (terabyte) | 1,000,000,000,000 | 1 TiB (tebibyte) | 1,099,511,627,776 | 9.95% |
The gap grows with each step, which is why it hardly matters for a 4 KB file and matters a lot for a 1 GB one. For a 10 MB limit, the two readings are 10,000,000 and 10,485,760 bytes, 485,760 bytes apart.
Storage vendors use the decimal system. Apple’s support page on how storage capacity is measured says manufacturers use base 10, so 1GB = 1 billion bytes, and that when capacity is measured in binary, 1 GB equals 1,073,741,824 bytes. It also names some software that reports binary values: iOS 10 and earlier, and OS X Leopard and earlier.
How common tools count
The same file gets a different label depending on the tool. We created two files, one of 10,485,760 bytes and one of 10,000,000, and read them back:
$ ls -lh b_10mib.bin b_10mb_dec.bin
-rw-r--r-- 1 nikhi 197610 10M ... b_10mib.bin
-rw-r--r-- 1 nikhi 197610 9.6M ... b_10mb_dec.bin
$ ls -l --si b_10mib.bin b_10mb_dec.bin
-rw-r--r-- 1 nikhi 197610 11M ... b_10mib.bin
-rw-r--r-- 1 nikhi 197610 10M ... b_10mb_dec.bin
ls -lh uses powers of 1024 and prints a bare M, and ls --si uses powers of 1000. Notice that --si rounds up: the 10,485,760-byte file shows as 11M. (We ran GNU ls 8.32; other ls implementations may print differently.) The numfmt tool shows the two families of names:
$ numfmt --to=iec-i 10485760
10Mi
$ numfmt --to=si 10000000
10M
Command-line tools that take sizes follow a rule that is easy to get wrong. The GNU coreutils manual says a bare size letter, or one followed by iB, means powers of 1024, while a letter followed by B means powers of 1000: “1M” and “1MiB” are 1048576, and “1MB” is 1000000. We checked it:
$ head -c 10M /dev/zero | wc -c
10485760
$ head -c 10MB /dev/zero | wc -c
10000000
$ truncate -s 10K f && stat -c%s f
10240
$ truncate -s 10KB f && stat -c%s f
10000
$ dd if=/dev/zero of=f bs=1MB count=10
10000000 bytes (10 MB, 9.5 MiB) copied ...
PowerShell follows the binary convention in its number literals. Its documentation lists kb, mb and gb as kibibyte, mebibyte and gibibyte multipliers, and we saw:
PS> 10KB
10240
PS> 10MB
10485760
PS> 1GB
1073741824
PHP uses binary shorthand too. Its manual says 1M equals one megabyte, 1048576 bytes, and 1K is 1024 bytes, and it notes that the IEC standard would call these kibibytes and mebibytes. macOS’s mkfile man page also defines its suffixes as k (1024) and m (1048576).
The habit to build: never assume. If a tool prints or accepts “MB”, check with a file of a known byte count.
What this site uses
The generator on dummyfiles.com uses binary units. One KB is 1,024 bytes, one MB is 1,048,576 bytes, and one GB is 1,073,741,824 bytes, so “10 MB” is 10,485,760 bytes. When you need the decimal reading, set the unit to B and type the byte count yourself, for example 10000000. Both readings are one field away, and each size page states its exact byte count.
To make either file yourself on the command line, see create a dummy file of any size.
Why the difference matters when you test limits
A limit expressed in megabytes hides a choice of unit, and the two units are 4.86% apart at the megabyte level. We tested nginx with two configurations of the same idea, a 10 MB limit:
client_max_body_size 10m; -> 10485760 bytes: 200, 10485761 bytes: 413
client_max_body_size 10000000; -> 10000000 bytes: 200, 10000001 bytes: 413
Both are “10 MB” in someone’s documentation, and a file of 10,485,760 bytes is accepted by the first and rejected by the second. If you ship a limit, publish it in bytes or in explicit KiB and MiB. If you test one, run both readings. The test file upload limits guide gives the N-1, N, N+1 method, and the nginx 413 guide has the full nginx run.
Remember that upload requests are also larger than the file inside them, because of multipart or Base64 wrapping, so “the file is exactly at the limit” can still be over it.
Try it
Build files at the sizes above with the Dummy PDF file generator: the Dummy 10 MB PDF file page gives 10,485,760 bytes, and typing 10000000 with the unit set to B gives the decimal 10 MB. The Dummy CSV file and Dummy Excel file pages work the same way for data files. Files are built in your browser and nothing is uploaded.
Sources
Accessed 30 September 2026.
- NIST, Prefixes for binary multiples (kibi, mebi, gibi and tebi): https://physics.nist.gov/cuu/Units/binary.html
- GNU coreutils manual, block size (K, KiB and KB): https://www.gnu.org/software/coreutils/manual/html_node/Block-size.html
- Microsoft, PowerShell numeric literals (
kb,mb,gbmultipliers): https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_numeric_literals - Apple Support, How storage capacity is measured on Apple devices: https://support.apple.com/en-us/102119
- PHP manual FAQ, shorthand byte values: https://www.php.net/manual/en/faq.using.php
- Apple
mkfile(8)man page, as published at https://keith.github.io/xcode-man-pages/mkfile.8.html (we did not runmkfile; it does not exist on our test machine) - All command output: GNU coreutils 8.32 and PowerShell 5.1 on Windows 11, and nginx 1.30.5, 29 September 2026.