SahlCalc سهل
Gulf Hubs:

Saudi Arabia: Labour: HRSD · Tax and zakat: ZATCA

Binary Calculator

Convert between decimal and binary with the working shown, or add, subtract, multiply and divide binary numbers exactly.

Digits 0–9, no decimal point; negatives allowed, e.g. 156 or −42

Binary

1001 1100

Hexadecimal

9C

Octal

234

Bits

8

Repeated division by 2 (8)
Number÷ 2Remainder
156780
78390
39191
1991
941
420
210
101

Formula with your numbers

  • Remainders, last to first 156₁₀ = 10011100₂
  • Check 2⁷ + 2⁴ + 2³ + 2² = 128 + 16 + 8 + 4 = 156

Quick answer: 156 in binary is 10011100: dividing by 2 repeatedly leaves remainders 0, 0, 1, 1, 1, 0, 0, 1, read from the last up; check: 128 + 16 + 8 + 4 = 156.

How it's calculated

Decimal to binary: divide the number by 2, write down the remainder (0 or 1), and repeat with the quotient until it reaches 0. The remainders read from the last to the first are the binary digits.

Binary to decimal: each digit is worth a power of 2, starting from 2⁰ = 1 on the right. Add the place values of the 1s: 10011100₂ = 2⁷ + 2⁴ + 2³ + 2² = 156.

Binary arithmetic follows the same rules as decimal with carries at 2: 1 + 1 = 10₂. The calculator works with whole numbers of any length; division gives the quotient and the remainder. For base 16 use the hex calculator.

Worked examples

  • Decimal to binary: 156 = 10011100₂
  • Binary to decimal: 10011100₂ = 128 + 16 + 8 + 4 = 156
  • Addition: 1011₂ + 110₂ = 10001₂ (11 + 6 = 17)

Powers of 2

PowerValueBinary
2⁰11
2¹210
2²4100
2³81000
2⁴1610000
2⁸256100000000
2¹⁰1,02410000000000
2¹⁶65,5361 followed by 16 zeros

Frequently asked questions

How many bits does a number need?

A whole number n ≥ 1 needs ⌊log₂ n⌋ + 1 bits: 156 needs 8 bits, 255 is the largest 8-bit number and 256 needs 9.

How are negative numbers written in binary?

This calculator shows a minus sign before the binary of the size. Computers usually store them in two's complement, which depends on the word size (8, 16, 32 or 64 bits).

Can I convert fractions such as 0.5?

Not here; the calculator handles whole numbers. In binary, 0.5 is 0.1₂ and 0.25 is 0.01₂.

What is 156 in binary?

10011100. That's 128 + 16 + 8 + 4.

What's the biggest number you can store in 8 bits?

255, which is eight ones: 11111111. With 16 bits you get up to 65,535.

How do I add binary numbers?

The same way as decimal, except you carry when you reach 2. 1011 + 110 = 10001, which is just 11 + 6 = 17.