When the bit count is the number you need
Bytes measure storage and files, but protocol fields, cryptographic keys and hardware buses are specified in bits. Converting is a single multiplication, which makes the page a quick check for the sizes that appear in specifications. The default of 10 bytes gives 80 bits. More familiar cases include an IPv4 address of 4 bytes, which is 32 bits, a hardware MAC address of 6 bytes, which is 48 bits, and an IPv6 address of 16 bytes, which is 128 bits. A UUID is also 16 bytes, and a SHA-256 hash is 32 bytes, or 256 bits. The page returns each of these as a whole number of bits. Counting in bits shows how many distinct values a field can hold, since n bits give 2 to the power n values. A 32 bit IPv4 address allows 4,294,967,296 addresses, and a 48 bit MAC address allows about 281 trillion, which is why hardware identifiers rarely run out.
Eight bits to a byte
The byte is not an SI unit, but the eight-bit byte is universal in current computing and networking, where the term octet is used to remove any doubt. Early machines used other sizes, such as six or seven bits for a character, which is why standards documents often say octet. The multiplication by 8 is exact, and the inverse is a division by 8, so 64 bits is 8 bytes and 12 bits is 1.5 bytes. NIST SP 811 and the SI Brochure do not define the byte, but the IEC standard for binary prefixes states that a byte is eight bits. The page follows that convention without exception.
Cryptographic key sizes
Key lengths are stated in bits, while key material in files and APIs is counted in bytes. An AES-128 key is 16 bytes and an AES-256 key is 32 bytes. A 2,048 bit RSA modulus occupies 256 bytes, and a 4,096 bit modulus occupies 512 bytes. Entering 32 bytes returns 256 bits, which confirms a key of the stated strength. A base64 or hexadecimal string is longer than the key, since hexadecimal uses two characters per byte and base64 about four characters per three bytes. A hex string of 64 characters therefore holds 32 bytes, which is 256 bits, and the conversion helps you check that a pasted key has the right length.
Network addresses and fields
Packet formats count fields in bits. An IPv4 header has a minimum length of 20 bytes, which is 160 bits. An Ethernet frame carries a 6 byte destination address and a 6 byte source address, which add up to 96 bits. A TCP port number is 16 bits, or 2 bytes, which gives 65,536 values. The converter helps when a standard lists lengths in one unit and an implementation needs the other. When a field is not a whole number of bytes, as with the 3 bit flags and 13 bit fragment offset of the IPv4 header, express the length in bits first and avoid fractions of a byte.
Memory words and error-correcting bits
Memory buses are often described in bits, such as a 64 bit data path, which is 8 bytes per transfer. Memory with error correction adds check bits. A standard ECC module carries 72 bits for every 64 bits of data, an extra 8 bits per 8 bytes, so each word occupies 9 bytes, though only 8 are visible to software. The overhead is 12.5 percent of the data width. These figures show why the bit and byte views of the same hardware differ. A module with ECC therefore holds 9 chips worth of data for every 8 that software can use, and the converter shows the bit count of either view.
Going from bits back to bytes
Choose bit as the source and byte as the target for the opposite direction. A 128 bit identifier is 16 bytes. A 100 bit field needs 12.5 bytes, so in practice 13 bytes must be allocated, with the remaining bits unused or padded. The same rounding appears in bitmaps: a bitmap of 1,000 flags takes 125 bytes, but 1,001 flags need 126. The converter returns the exact fraction, and you decide whether to round up for storage. Padding to byte or word boundaries is a standard step in file and protocol design. Compilers do the same for structures in memory, inserting unused bytes so each field starts at a convenient address, which is why the size of a structure can exceed the sum of the field sizes you wrote down.
Bits per second versus bits
Bits are an amount of information and bits per second are a rate. This page converts amounts. To convert a rate, use the rate converters, which also account for time and prefixes. A transfer of 10 bytes takes 80 bit times on a serial line, but real serial framing adds start and stop bits, so a byte takes 10 bit times in the common 8N1 format and 10 bytes take 100 bit times. The difference between data bits and bits on the wire is a frequent source of confusion in timing calculations. For a sensor that sends 20 bytes every second over such a line, the wire carries 200 bit times of activity per second, so at 9,600 baud the line is busy about 2 percent of the time.
Notation to avoid mistakes
Lowercase b stands for bit and uppercase B for byte, according to the conventions used in IEC and IEEE standards. A bandwidth of 8 Mb is 1 MB, and a mix-up between them gives a factor of 8 error. Do not write bits as bytes in tables of key lengths or field widths, and put the unit in the column heading. Also state the base of any count. A 256 bit key written as 256 and a 256 byte buffer written the same way differ by a factor of 8, and only the unit tells the reader which one the author meant. When you see a number without a unit in a specification, check the surrounding text, since both appear in the same document. Hardware documents often write widths as a number of bits in the part name, so a 32-bit processor works on 4 byte words, and a 64-bit one on 8 byte words, which this page confirms as 32 and 64 bits from 4 and 8 bytes.