Beetwise

Convert binary to decimal

To convert a binary value into decimal, find each bit that has the value 1.

Each bit position holds a power of two.

Add the powers of two of all the bits that have the value 1.

Try binary to decimal conversion in the bit editor

The bits 100101100, which give 300. Edit the expression or select a bit to flip it.

15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
300
value · 16 bits · unsigned
binary
0b0000000100101100

Binary to decimal conversion step by step

Convert 100101100 into a decimal value: The steps follow the value above.

  1. Bit 8 has the value 1. Add 2^8, which is 256.
  2. Bit 5 has the value 1. Add 2^5, which is 32.
  3. Bit 3 has the value 1. Add 2^3, which is 8.
  4. Bit 2 has the value 1. Add 2^2, which is 4.
  5. The total is 300.

The value of each bit position

The value of each bit position
BitPower of twoValue
02^01
12^12
22^24
32^38
42^416
52^532
62^664
72^7128
82^8256
92^9512
102^101024
112^112048
122^124096
132^138192
142^1416384
152^1532768

Where binary to decimal conversion is used

A logic analyser and a serial monitor often show a raw binary value.

A decimal form is easier to compare against a specification limit.

Binary to decimal conversion: points to note

  • Bit numbers start at 0, not 1.
  • The result depends on the signed mode. The bits 11111010 give 250 unsigned and -6 signed.
  • Zeros at the left do not change the result.

The full bit editor

The full editor holds many values, evaluates expressions across them, and reads live values from a serial port.

Open this value in the full editor

Questions about binary to decimal conversion

What is 100101100 in decimal?
The value is 300. The set bits are 8, 5, 3 and 2, which give 256 + 32 + 8 + 4.
Does the bit width change the result?
Not for an unsigned value. For a signed value the bit width sets which bit is the top bit.
What is 11111111 in decimal?
As an unsigned 8-bit value it is 255. As a signed 8-bit value it is -1.