Why embedded and systems work uses KiB
Firmware engineers, kernel developers and hardware designers work with sizes that are powers of two. A microcontroller may have 32 KiB of flash, a CPU cache line holds 64 bytes, and a memory page on common processors is 4 KiB. A register map or a bitfield listing counts in bits, and a memory map lists regions in KiB. This page connects the two by dividing a bit count by 8,192, the number of bits in a kibibyte. The result is a binary quantity, and the symbol KiB tells the reader that one unit is 1,024 bytes and not 1,000.
The definition of the kibibyte
The prefix kibi, symbol Ki, was standardized by the IEC in 1998 and is part of IEC 80000-13. It stands for 2¹⁰, which is 1,024. NIST SP 811 lists it with the other binary prefixes, kibi, mebi, gibi, tebi, pebi and exbi. One kibibyte is 1,024 bytes, which is 8,192 bits, and the factor from bits is 1 over 8,192, or 0.0001220703125. The factor ends in a finite decimal because 8,192 is a power of two, so the calculation is exact. The older habit of writing KB for 1,024 bytes still appears in many programs, and the kibibyte name removes that doubt.
Reading the default of 10 bits
Ten bits come to 0.001220703125 KiB. The number looks longer than the decimal kilobyte result, 0.00125 kB, for the same input, and it is smaller, because the kibibyte is larger by 2.4 percent. The ratio 1,024 to 1,000 is the whole difference between the two pages at the kilo level, and it grows with each prefix step. As a check, 8,192 bits give exactly 1 KiB, and half of that, 4,096 bits, gives 0.5 KiB. The default is a trace of a kibibyte, so the real use of the page begins at inputs in the thousands or tens of thousands of bits.
Pages, blocks and a hundred thousand bits
A memory page of 4 KiB contains 32,768 bits, so entering 32,768 returns 4. A file system block of 4,096 bytes is the same size, and a flash erase block may be 4 KiB, 64 KiB or more depending on the device. An input of 100,000 bits comes to 12.20703125 KiB, a figure that is not a whole number of KiB, which tells you that the data would need 13 whole kibibytes if stored in 1 KiB units. Rounding up to the allocation unit is the step that matters for capacity planning, and the converted value tells you how close to the boundary you are. A result of 12.2 KiB leaves 0.8 KiB unused in a 13 KiB allocation, while 12.99 would leave almost nothing and would cross the boundary after a very small change in the data.
Reversing from kibibytes to bits
Swap the units to multiply by 8,192. A buffer of 2 KiB holds 16,384 bits, and a 64 KiB memory region holds 524,288 bits. An 8 KiB EEPROM stores 65,536 bits. Designers use this direction when a datasheet lists capacity in bits, as many memory chips do, and a firmware map lists it in KiB. The numbers are powers of two, and a result that is not a power of two for a memory component usually points to a mistake in the input, or to a part that reserves some of its cells for error correction or spares, which a datasheet should state.
KiB versus kB in practice
The difference between 1,000 and 1,024 is 2.4 percent per kilo step, which is small enough to be ignored in casual use and large enough to break an exact fit. A table of 1,000 entries of 1 KiB each does not fit in a 1,000 kB region, because it needs 1,024,000 bytes against 1,000,000. A protocol header limit of 8 kB is 8,000 bytes, while one of 8 KiB is 8,192, a difference of 192 bytes that decides whether a message fits. In both cases the unit symbol in the specification, not the sound of the abbreviation, tells you which number to use.
Precision of the result
Because the divisor is a power of two, the quotient is exact in binary floating point, and decimal output such as 0.0001220703125 is an exact representation, not a rounded one. For display, a long tail of digits is unnecessary. Write 0.00122 KiB if only three digits matter, or give the value in bits instead. In specifications, sizes in KiB are normally whole numbers or simple fractions, such as 0.5, 0.25 and 0.125. Results with other tails show that the bit count was not built from a binary structure, and they can be rounded up to a unit that the hardware can allocate.
Reserved bits and usable memory
The page performs arithmetic on units. It does not know how a particular device organizes its memory, whether some bits are reserved for parity, error-correcting codes or wear leveling, or how a file system rounds sizes up. A flash device sold with 32 KiB may expose less usable space after a bootloader or configuration area. A network protocol field of a given number of bits is not an object that sits in memory at that size, because compilers pad structures to alignment boundaries. For the exact layout, use the datasheet or the compiler output, and use this page for the unit arithmetic. When sizes are close to a limit, compute the headroom in both bits and KiB and keep a few percent in reserve, because later firmware versions tend to grow and a table that fits today with 48 bytes spare will not survive another feature.
Fitting a lookup table into flash
A lookup table of 1,000 entries of 12 bits each holds 12,000 bits, which is 1.4648 KiB. If the entries are stored in 16-bit words, the table is 16,000 bits, or 1.953 KiB. On a part with 2 KiB of free flash, the packed form fits with room to spare and the word-aligned form fits with only about 48 bytes left. These sizes are illustrative, and a compiler may add alignment or a header. The check is still the right first step. Convert the bit count to KiB here, compare with the free space, and then confirm the real size in the map file produced by the linker.