To convert binary to decimal, multiply each bit by its power-of-two place value and add the results. To convert binary to hexadecimal, divide the binary number into four-bit groups and replace each group with its hexadecimal digit.
Binary to decimal
Binary is a base- number system using positional notation. Starting from the right, the place values are , and so on.
The rightmost bit is the least significant bit (LSB), while the leftmost displayed bit is the most significant bit (MSB). A bit set to contributes its place value; a bit set to contributes nothing. Therefore, only powers corresponding to bits appear in the final sum.
For example, convert to decimal:
Therefore, .
Binary to hexadecimal
Each hexadecimal digit represents one nibble, meaning four binary bits. Group the bits from the right:
Hexadecimal is base and uses digits to and letters A to F, where A represents and F represents . Four bits map exactly to one hexadecimal digit because they provide possible patterns. Hexadecimal therefore displays long binary values more compactly.
| Binary group | Decimal value | Hexadecimal digit |
|---|---|---|
Thus, . This can be checked using hexadecimal place values: .
A common misconception is to form four-bit groups from the left. Always group from the least significant bit on the right; if necessary, add leading zeros on the left. For example, becomes , not . For a bit string whose length is not a multiple of four, leading zero padding preserves its value.
IB exam technique
In A1.2 Data representation and computer logic, show either the power-of-two place values or the four-bit groupings. Examiners should be able to follow your conversion method; retaining leading zeros within each nibble also prevents avoidable hexadecimal errors. Label the bases and keep every intermediate group visible; an unsupported final answer may lose method marks if an error occurs.