Binary Calculator

You can add, subtract, multiply, and divide binary numbers, convert binary numbers to decimal, convert decimal numbers to binary, and convert binary numbers to hexadecimal.

Binary Calculator

= ?

Binary to Decimal

Binary: = ?

Decimal to Binary

Decimal: = ?

Binary to Hexadecimal

Binary: = ?

What Is a Binary Number?

A binary number is a number expressed in base 2. Unlike the decimal system, which uses ten digits from 0 to 9, the binary system uses only two digits: 0 and 1. Each position in a binary number represents a power of 2.

For example:

10112 = 1 × 23 + 0 × 22 + 1 × 21 + 1 × 20 = 8 + 0 + 2 + 1 = 1110

Common Binary, Decimal, and Hexadecimal Values

Binary00000001001000111000101011001111000100110101011110011011110111110000
Decimal012345678910111213141516
Hex0123456789ABCDEF10

Binary Addition Formula and Method

Binary addition follows base-2 rules:

  • 0 + 0 = 0
  • 0 + 1 = 1
  • 1 + 0 = 1
  • 1 + 1 = 10, which means write 0 and carry 1
  • 1 + 1 + 1 = 11, which means write 1 and carry 1

General addition formula:

Binary sum = add each bit from right to left and carry when the sum is 2 or greater.

Example:
  10101
+    11
-------
  11000

Decimal check:

101012 = 2110, and 112 = 310. Therefore:

21 + 3 = 24, and 2410 = 110002.

Binary Subtraction Formula and Method

Binary subtraction follows base-2 borrowing rules:

  • 0 - 0 = 0
  • 1 - 0 = 1
  • 1 - 1 = 0
  • 0 - 1 requires borrowing from the next higher bit

When borrowing in binary, 102 is equal to 210. Therefore, after borrowing:

102 - 12 = 12

Example
  10101
-    11
-------
  10010

Decimal check:

101012 = 2110, and 112 = 310.

21 - 3 = 18, and 1810 = 100102.

Binary Multiplication Formula and Method

Binary multiplication is similar to decimal long multiplication, but each digit is either 0 or 1.

  • 0 × 0 = 0
  • 0 × 1 = 0
  • 1 × 0 = 0
  • 1 × 1 = 1

General method:

  1. Multiply the first binary number by each bit of the second number.
  2. Shift each partial product left according to its bit position.
  3. Add all partial products together.
Example
    10101
×     11
---------
    10101
+  101010
---------
   111111

Decimal check:

101012 = 2110, and 112 = 310.

21 × 3 = 63, and 6310 = 1111112.

Binary Division Formula and Method

Binary division uses the same long division method as decimal division. The calculator returns both a quotient and a remainder when needed.

General formula:

Dividend = Divisor × Quotient + Remainder

In base notation:

Dividend2 ÷ Divisor2 = Quotient2 with Remainder2

Example: 101012 ÷ 112
Binary Division Example

Decimal check:

101012 = 2110, and 112 = 310.

21 ÷ 3 = 7, and 710 = 1112.

Therefore:

101012 ÷ 112 = 1112

Binary to Decimal Formula

For a binary number with digits bnbn-1...b0, the decimal value is:

Decimal = bn × 2n + bn-1 × 2n-1 + ... + b0 × 20

Example: Convert 101012 to decimal:

101012 = 1 × 24 + 0 × 23 + 1 × 22 + 0 × 21 + 1 × 20

= 16 + 0 + 4 + 0 + 1 = 21

Therefore:

101012 = 2110

Decimal to Binary Conversion Method

Repeated division method:

  1. Divide the decimal number by 2.
  2. Write down the remainder, either 0 or 1.
  3. Continue dividing the quotient by 2 until the quotient becomes 0.
  4. Read the remainders from bottom to top to get the binary number.

Decimal to Binary Formula

A decimal number can be represented as a sum of powers of 2:

Decimal = an × 2n + an-1 × 2n-1 + ... + a0 × 20

where each coefficient a is either 0 or 1.

Example: Convert 25010 to binary:

250 = 128 + 64 + 32 + 16 + 8 + 2

In powers of 2:

250 = 27 + 26 + 25 + 24 + 23 + 21

The powers from 27 to 20 are:

Power2726252423222120
Value1286432168421
Bit11111010

Therefore:

25010 = 111110102

Binary to Hexadecimal Conversion Method

  1. Start from the right side of the binary number.
  2. Group the digits into sets of four bits.
  3. Add leading zeros to the left if the first group has fewer than four bits.
  4. Convert each 4-bit group into one hexadecimal digit.
  5. Combine the hexadecimal digits.

Binary to Hexadecimal Formula

Each group of four binary digits has the value:

Hex digit value = b3 × 23 + b2 × 22 + b1 × 21 + b0 × 20

The decimal values 10 to 15 are represented by hexadecimal letters:

  • 10 = A
  • 11 = B
  • 12 = C
  • 13 = D
  • 14 = E
  • 15 = F

Convert 101012 to hexadecimal:

First, group the binary digits from right to left:

10101 → 0001 0101

Convert each group:

Binary Group00010101
Decimal Value15
Hexadecimal Digit15

Therefore:

101012 = 1516

References

The following references provide useful background information about binary numbers, digital systems, and computing concepts:

Write Reply to This Calculator

Leave a Reply

Your email address will not be published. Required fields are marked *

^