Binary to decimal
Each binary digit is a power of 2, counting from the right starting at 1. Add the values of the positions that hold a 1. So 1001 is 8 + 1 = 9.
Last reviewed 2026-11-04.
never leaves your browser
Worked example: 1001
| Bit | 1 | 0 | 0 | 1 |
|---|---|---|---|---|
| Value | 8 | 4 | 2 | 1 |
| Counts | 8 | 0 | 0 | 1 |
8 + 0 + 0 + 1 = 9.
Examples
| Binary | Decimal |
|---|---|
| 0001 | 1 |
| 0100 | 4 |
| 1001 | 9 |
| 1111 | 15 |
| 101010 | 42 |
| 11111111 | 255 |
Notes
- Leading zeros change nothing:
0001is 1 and0100is 4. - n ones in a row equal 2^n minus 1:
1111is 15,11111111is 255. - The tool reads the
0bprefix, so0b1001is treated as binary.
A longer example: 101010
Positions from the right are 1, 2, 4, 8, 16, 32. The bits 101010 have ones at 32, 8 and 2, so the value is 32 + 8 + 2 = 42. A quick method is doubling: start at 0, then for each bit double the running total and add the bit. For 101010 that gives 1, 2, 5, 10, 21, 42.
Binary fractions
Digits after the point are negative powers of 2: 1/2, 1/4, 1/8. So 0.101 is 1/2 + 1/8 = 0.625. See decimal to binary for the reverse.
In code
$ parseInt('1001', 2) // 9
0b1001 // 9 (literal)Running this on a server
Servers for small tools are compared in the hosting guide.
Frequently asked questions
What is 1001 in decimal?
9.
What is 0100 in decimal?
4.
What is 0001 in decimal?
1.
Sources
- MDN: parseInt() checked 2026-11-04
- MDN: Numeric literals (binary) checked 2026-11-04