Place-value system (binary to decimal)
In short: In a place-value system each digit has a different value depending on its position. The decimal system uses powers of ten, the binary system powers of two.
In more detail: In decimal 325 the 3 stands for 3·100, the 2 for 2·10 and the 5 for 5·1. In binary there are only 0 and 1, and the place values are 1, 2, 4, 8, 16, 32, 64, 128 and so on (doubling from right to left).
In Depth
Converting binary to decimal
Table of place values:
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 |
Add the place values that have a 1 below them: 128 + 32 + 16 + 4 + 1 = 181.
Decimal to binary
Check from the left whether the place value fits into the number: if so write 1 and subtract, otherwise 0. Example 37: 128 (no) 0, 64 (no) 0, 32 (yes, remainder 5) 1, 16 0, 8 0, 4 (yes, remainder 1) 1, 2 0, 1 1 → 00100101.
Why binary?
Computers only know two states (current on or off). A bit is one place, eight bits are a byte (values 0 to 255). The hexadecimal system is handy too (hex codes): one hex digit equals four bits.
With the number-system calculator in the tools section you can practise conversions with the working shown.
See also: bit depth, IP addresses