Binary numbers (referred to as base-2) represent values in terms of 0s and 1s (called binary digits, or more commonly bits). Contrast this with base-10, which represents it in terms of 10 different numbers. All information in computer hardware is represented in binary. For an -bit binary number, the maximum base-10 representation is .
The most significant bit is the bit that is furthest to the left. The least significant bit is the one furthest to the right. A byte is 8-bits long.
Conversions
To convert from binary to base-10, we work backwards according to this formula:
where the starting number is the last digit and we work backwards. For example:
To convert from base-10 to binary, we successively divide our number by 2, take the remainder, and continue dividing the result until the result is 0. We start at the least significant bit from the top and move down to the most.