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
Decimal to Binary
Binary to Hexadecimal
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 ValuesBinary 0000 0001 0010 0011 100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 10000 Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Hex 0 1 2 3 4 5 6 7 8 9 A B C D E F 10
Binary Addition Formula and Method
| Binary | 0000 | 0001 | 0010 | 0011 | 100 | 0101 | 0110 | 0111 | 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110 | 1111 | 10000 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Decimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| Hex | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | 10 |
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
Example10101 - 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:
- Multiply the first binary number by each bit of the second number.
- Shift each partial product left according to its bit position.
- Add all partial products together.
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
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:
- Divide the decimal number by 2.
- Write down the remainder, either 0 or 1.
- Continue dividing the quotient by 2 until the quotient becomes 0.
- 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:
| Power | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
| Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| Bit | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 0 |
Therefore:
25010 = 111110102
Binary to Hexadecimal Conversion Method
- Start from the right side of the binary number.
- Group the digits into sets of four bits.
- Add leading zeros to the left if the first group has fewer than four bits.
- Convert each 4-bit group into one hexadecimal digit.
- 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 Group | 0001 | 0101 |
| Decimal Value | 1 | 5 |
| Hexadecimal Digit | 1 | 5 |
Therefore:
101012 = 1516
References
The following references provide useful background information about binary numbers, digital systems, and computing concepts:
Write Reply to This Calculator