Skip to content
DailyCalc

Binary to Decimal Converter

Converts binary to decimal and back, showing the bit weights that produce the answer.

Last updated

Your details

Result

Binary (base 2)
11111111
Decimal (base 10)
255
Hexadecimal (base 16)
FF
Octal (base 8)
377
Bits needed
8

2 hex digits

11111111 in base 2…

value = Σ digit × baseᵖᵒˢⁱᵗⁱᵒⁿ

8 digits, read right to left

Each position is worth 2 times the one to its right

Total in decimal: 255

255

Formula — written step by step

Binary 11111111…

value = Σ bit × 2ᵖᵒˢⁱᵗⁱᵒⁿ

Weights from the right: 1, 2, 4, 8, 16, 32, 64, 128

Every bit is set, so all eight are added

128+64+32+16+8+4+2+1

11111111 = 255

Each bit is worth twice the one to its right. Eight bits set to one give 255, which is why a byte holds 256 distinct values counting zero — and why so many limits in computing are 255 or 256.

A worked example

Reading an IP address octet

Binary
11000000
Context
the first octet of 192.168.0.1
  1. Bits set: positions 7 and 6
  2. 2⁷ = 128, 2⁶ = 64
  3. 128 + 64
  4. All other bits are zero

11000000 = 192

An IPv4 address is four bytes written as four decimal numbers, each 0 to 255. Subnet masks are far easier to understand in binary: 255.255.255.0 is twenty-four ones followed by eight zeros, which is what /24 means.

How to use this calculator

  1. Enter a binary value using only 0 and 1. A leading 0b is accepted and ignored.
  2. Read the decimal equivalent, with hexadecimal and octal alongside.
  3. Switch the mode to convert a decimal number into binary.
  4. The bits-needed row tells you how many binary digits the value occupies, which is the storage it requires.

Counting in twos

Binary is base two, using only the digits 0 and 1. Each position is worth twice the one to its right, so reading from the right the weights run 1, 2, 4, 8, 16, and so on. Converting to decimal means adding the weights of every position holding a 1.

That is the whole method. 1011 is 8 + 0 + 2 + 1 = 11. There is no trick beyond knowing the weights, which is why binary is the easiest base to convert by hand once the doubling sequence is familiar.

Why computers use it

A binary digit needs a component that distinguishes just two states — on or off, charged or not. That is enormously easier to build reliably than something distinguishing ten voltage levels, and far more tolerant of noise and manufacturing variation.

Everything else follows from that choice. Storage is measured in bits and bytes, capacities cluster around powers of two, and the awkward distinction between a kilobyte as 1000 bytes and a kibibyte as 1024 exists because ten is not a power of two.

Converting decimal to binary

The usual hand method is repeated division by two, recording each remainder and reading them upward at the end. Dividing 11 gives remainders 1, 1, 0, 1 — which read backwards is 1011.

A quicker mental method is subtracting the largest power of two that fits, and repeating. For 200: subtract 128, leaving 72; subtract 64, leaving 8; subtract 8, leaving 0. Bits at 128, 64 and 8 gives 11001000.

Bit weights and what they hold

BitsHighest valueDistinct valuesCommonly
112A flag
41516One hex digit — a nibble
8255256A byte; one colour channel
1665,53565,536A port number
324,294,967,2954.29 billionAn IPv4 address
641.8 × 10¹⁹1.8 × 10¹⁹A modern integer

Each extra bit doubles the range. This is why 32-bit systems cap at about 4 GB of addressable memory, and why moving to 64 bits removed the ceiling rather than merely raising it.

Frequently asked questions

Why is 255 such a common limit?

Because it is the largest value eight bits can hold, and eight bits is one byte. Anything stored in a single byte caps at 255.

What is 0b?

A prefix marking a binary literal in many programming languages, in the same way 0x marks hexadecimal. It carries no value.

How do I convert decimal to binary by hand?

Divide repeatedly by two, keeping each remainder, then read the remainders in reverse. Or subtract the largest fitting power of two and repeat.

Why does binary use so many digits?

Because each digit carries the least possible information — one of two states. Eight binary digits carry the same value as two hexadecimal ones, which is why hex is preferred for writing.