Mebibytes in memory and image work

The mebibyte is the unit at which memory is easiest to reason about. A program allocates a 64 MiB buffer, a container is limited to 512 MiB of RAM, a JVM heap is set to 256 MiB, and a memory map reports regions in bytes that you divide down by hand. Disk images and optical media are described the same way: a standard CD data area is about 700 MiB, and the tools that burn or verify images report byte lengths. Converting those byte lengths to MiB gives a figure that fits the vocabulary of the tool configuration. The page is aimed at that moment, when a long integer needs to be read as a size in the unit that the setting uses. It handles the reverse as well, so a configured size in MiB can be checked against a byte value printed by a crash dump or a monitoring agent.

The arithmetic and its exactness

A mebibyte is 1,024 kibibytes of 1,024 bytes each, so it holds 1,048,576 bytes. Dividing a byte count by that number gives MiB. Since the divisor is a power of two, the decimal expansion of the result always terminates, though it can run to twenty digits. Ten bytes gives 0.0000095367431640625, the exact value, which the factor shown on the page rounds to 9.53674316406e-7. The prefix mebi was standardized by the IEC with the other binary prefixes in 1998 and 1999 and is documented in IEC 80000-13. In the SI Brochure, the mega prefix is reserved for 10 to the 6th power.

Why 10 bytes looks tiny in MiB

The page begins with 10 bytes, which converts to about 0.0000095367 MiB, or 9.5367e-6 in scientific notation. Ten bytes is far below the scale of this unit, so the figure is only a demonstration that the conversion is wired correctly. For a realistic input, try 5,000,000 bytes, which is about 4.76837 MiB, or 25,000,000 bytes, which is about 23.8419 MiB. A quick sanity test is to remember that the binary figure is always about 4.6 percent smaller than the decimal megabyte figure, since 1,048,576 is about 4.86 percent larger than 1,000,000. If the MiB number is larger than the MB number for the same input, something has been entered backward. Another quick test uses 1,048,576 bytes, which must return exactly 1 MiB. If it does not, the From menu is not set to Bytes.

The 700 MiB disc and the 1.44 floppy

A byte count of 734,003,200 converts to exactly 700 MiB, which is how the data capacity of a standard 80 minute CD-R is commonly described. Optical media were among the last everyday products to quote capacity in binary megabytes, which makes MiB the natural unit when you work with disc images. The same count is 734.0032 MB in decimal, so a disc image listed as 700 MB by one tool and 734 MB by another is the same file. The 1,474,560 byte floppy disk image gives 1.40625 MiB, a number that explains the confusion around its marketing label of 1.44 MB. For a one billion byte file, the page shows about 953.674 MiB, a size that a binary display rounds to 954 and a decimal one calls 1,000.

Converting MiB back to bytes

Select Mebibytes in the From menu and Bytes in the To menu to multiply by 1,048,576. A 700 MiB image is 734,003,200 bytes. A 256 MiB heap is 268,435,456 bytes. This is the direction used when an application expects a byte value, for instance a JVM flag written in bytes, a kernel parameter for a memory limit, or a database setting for a cache. Entering the exact MiB count avoids rounding trouble. When the figure has a fractional part, such as 12.5 MiB, the product 13,107,200 bytes is still exact because 1,048,576 times 12.5 is a whole number.

Container limits and the binary suffix

Container platforms and process managers often accept memory limits written with a Mi suffix, which means mebibytes, alongside M for decimal megabytes. A limit written as 512Mi equals 536,870,912 bytes, while 512M equals 512,000,000 bytes, a difference of about 4.7 percent. A process that is killed for exceeding a limit may have crossed it only because the suffix was read the wrong way. Converting the byte value that appears in an out-of-memory log into MiB, and comparing with the limit as written, settles which definition applies. This page is a quick way to do that comparison without a calculator.

Virtual machines, ISOs and installers

Operating system installers are the other common home for mebibyte figures. A distribution ISO of 2,684,354,560 bytes is 2,560 MiB, which is exactly 2.5 GiB. A Windows or Linux installer image written to a USB stick must fit the stick, so the byte length from the download page is the number to convert. Hypervisors allocate guest RAM in MiB, with 4,096 MiB equal to 4,294,967,296 bytes, and they list disk image sizes the same way. When a guest tool reports 3,968 MiB free, multiplying by 1,048,576 gives the exact byte count if you need to script against it.

Digits needed for mebibyte sizes

The output keeps all digits that the floating-point result carries, which for MiB values is up to about sixteen significant figures. That is more than any report needs. Two decimal places suffice for a size comparison, and four are plenty for capacity planning at the mebibyte scale. If the number will be converted back to bytes, keep the original byte count instead of the rounded MiB value, because 4.77 MiB is 5,001,543 bytes, not the 5,000,000 you started with. Small differences like that matter for exact limits and checksums. A cache of 4.77 MiB is also not something a program can allocate, since allocators work in whole bytes and usually in whole pages of 4,096 bytes.

Common mix-ups with MB and Mb

Three similar symbols cause most errors. MiB is the binary mebibyte of 1,048,576 bytes. MB is the decimal megabyte of 1,000,000 bytes. Mb, with a lowercase b, is a megabit. Mixing MiB and MB produces an error of 4.86 percent, and mixing bytes with bits produces a factor of eight. A download that reaches 100 Mbit/s moves 12.5 MB per second, which is about 11.92 MiB per second. Reading a speed in megabits as if it were megabytes makes a transfer look eight times faster than it is, so it is worth checking the capitalization of the b before trusting any size or speed.