Binary Calculator
Print| Decimal Value | 92 |
| Hexadecimal Value | 5C |
| Octal Value | 134 |
The binary system is a base-2 numerical system that operates identically to the decimal (base-10) system. While decimal uses ten digits (0 through 9) representing powers of 10, binary uses only two digits (0 and 1, called bits) representing powers of 2. Because of this simplicity, almost all modern computers and digital circuits use binary, as it is much easier to implement using hardware states (such as voltage high/low, or transistor states on/off).
Our free Binary Calculator performs binary addition, subtraction, multiplication, and division, and provides bidirectional conversions between binary and decimal formats. Input your bits or decimal numbers to see the step-by-step mathematical translation.
Converting Between Binary & Decimal
Each digit position in binary represents a power of 2 (2^n), starting with 2^0 on the far right. Below is a quick conversion reference:
| Decimal | Binary | Decimal | Binary |
|---|---|---|---|
| 0 | 0 | 7 | 111 |
| 1 | 1 | 8 | 1000 |
| 2 | 10 | 10 | 1010 |
| 3 | 11 | 16 | 10000 |
1. Decimal to Binary Conversion
To convert a decimal number to binary:
- Find the largest power of 2 that fits within the decimal number.
- Subtract that power of 2 from the decimal number.
- Find the largest power of 2 that fits in the remainder.
- Repeat this subtraction until the remainder is 0.
- Place a 1 in the positions of the powers used, and a 0 in the rest.
Example: Convert 18 to binary.
– Largest power of 2 in 18 is 16 (2^4). remainder: 18 - 16 = 2.
– Largest power of 2 in 2 is 2 (2^1). remainder: 2 - 2 = 0.
Aligning the columns: 2^4 (1), 2^3 (0), 2^2 (0), 2^1 (1), 2^0 (0).
18 in decimal is equivalent to 10010 in binary.
2. Binary to Decimal Conversion
Sum the positional powers of 2 for every position containing a 1.
Example: Convert binary 10111 to decimal.
10111 = (1 × 2^4) + (0 × 2^3) + (1 × 2^2) + (1 × 2^1) + (1 × 2^0)
10111 = 16 + 0 + 4 + 2 + 1 = 23.
Binary Arithmetic Operations
1. Binary Addition
Binary addition follows the same rules as decimal addition, but you carry over a 1 when the sum of a column equals 2 (written as 10 in binary):
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 0 (carry 1 to the next column, i.e., 10)
- 1 + 1 + 1 (with carry) = 1 (carry 1, i.e., 11)
Addition Example:
10111 (23)
+ 01011 (11)
-------
= 100010 (34).
2. Binary Subtraction
Borrowing occurs when you subtract 1 from 0. Borrowing from the left column reduces that column’s bit value by 1 and adds 2 (written as 10) to the current borrowing column:
- 0 – 0 = 0
- 1 – 0 = 1
- 1 – 1 = 0
- 0 – 1 = 1 (borrow 1, changing 0-1 into 2-1 = 1 in decimal terms)
Subtraction Example:
10110 (22)
- 00101 (5)
-------
= 10001 (17).
3. Binary Multiplication
Binary multiplication is simpler than decimal multiplication because the digits are only 0 and 1. You shift rows to the left and add placeholders just like in standard long multiplication:
10111 (23)
× 11 (3)
---------
10111
+ 101110 (placeholder 0 added)
---------
= 1000101 (69).
4. Binary Division
Binary division follows the long division format, using binary subtraction at each step:
Divide 10101 (21) by 11 (3):
00111 (7)
-------
11 | 10101
- 11
-----
100
- 11
-----
11
- 11
----
0
The result is 111 (7 in decimal).
Analyze network boundaries using our IP Subnet Calculator or solve general calculations with the Scientific Calculator.
Frequently Asked Questions (FAQ)
Why do computers use binary instead of decimal?
Computers use digital transistors that act as switches. It is electrically simple and reliable to detect only two states: “on” (voltage present, representing 1) and “off” (voltage absent, representing 0). Designing hardware to accurately detect ten separate voltage states for a decimal system would be incredibly complex and error-prone.
What is a bit and a byte?
A “bit” (short for binary digit) is the smallest unit of data in a computer, representing a single 0 or 1. A “byte” is a group of 8 bits. A single byte can represent 256 unique values (from 0 to 255 in decimal).
What is the 1 + 1 carry rule in binary addition?
Since binary only uses 0 and 1, the number 2 is represented as 10. When adding 1 + 1 in a column, the result is 0 and you must carry the 1 over to the next column on the left, which has twice the place value.
How do negative numbers work in binary?
To represent negative numbers, computers use a system called Two’s Complement. In this system, the most significant bit (the leftmost bit) acts as a sign indicator. If it is 1, the number is negative; if it is 0, the number is positive. To negate a binary number, you invert all the bits (changing 0 to 1 and vice versa) and add 1.