plain/devtools home

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.

number-basesampless sample

never leaves your browser

Worked example: 1001

Bit1001
Value8421
Counts8001

8 + 0 + 0 + 1 = 9.

Examples

BinaryDecimal
00011
01004
10019
111115
10101042
11111111255

Notes

  • Leading zeros change nothing: 0001 is 1 and 0100 is 4.
  • n ones in a row equal 2^n minus 1: 1111 is 15, 11111111 is 255.
  • The tool reads the 0b prefix, so 0b1001 is 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

Related

esc
↑↓ move↵ open? all shortcuts

Keyboard shortcuts

Cmd or Ctrl shortcuts always work.
Everywhere
Everywhere
Open the command palette
CtrlK
Open the palette (outside a text field)
/
Show these shortcuts
?
Toggle light and dark theme
t
Go home
gh
Go to all tools
gt
On a tool page
On a tool page
Run the main action
Ctrl↵
Copy the output
c
Load the next sample
s
Focus the input
i
Leave a text field
Esc
Previous or next tool
[]
In the palette
In the palette
Move the selection
↑↓
Open the selected item
↵
Close
Esc