A binary calculator performs arithmetic operations (addition, subtraction, multiplication, division) on binary numbers and converts between number systems. Binary is the foundation of all computing — understanding it is essential for CS students, developers working with low-level code, and networking professionals.
Calculate Binary Math Instantly
Add, subtract, multiply binary numbers. Convert between binary, decimal, octal, hex.
Number Systems: Binary, Decimal, Octal, Hex
| System | Base | Digits | Example (42) | Used In |
|---|---|---|---|---|
| Binary | 2 | 0, 1 | 101010 | CPU, memory, logic gates |
| Octal | 8 | 0-7 | 52 | Unix file permissions |
| Decimal | 10 | 0-9 | 42 | Everyday math |
| Hexadecimal | 16 | 0-9, A-F | 2A | Colors, memory addresses, MAC |
Binary Arithmetic Rules
Binary Addition
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10 (0, carry 1)
1 + 1 + 1 = 11 (1, carry 1)Example: 1011 + 1101
1011 (11)
+ 1101 (13)
------
11000 (24)Binary Subtraction (Two's Complement)
To subtract: invert all bits of the subtrahend, add 1, then add to minuend. This is how computers actually subtract.
How to Convert Between Number Systems
Decimal → Binary
Repeatedly divide by 2, read remainders bottom-up: 42 ÷ 2 = 21 r0, 21 ÷ 2 = 10 r1, 10 ÷ 2 = 5 r0, 5 ÷ 2 = 2 r1, 2 ÷ 2 = 1 r0, 1 ÷ 2 = 0 r1 → 101010
Binary → Decimal
Multiply each bit by 2^position: 101010 = 1×32 + 0×16 + 1×8 + 0×4 + 1×2 + 0×1 = 42
Binary → Hex (Shortcut)
Group binary into 4-bit chunks: 0010 1010 → 2 A → 0x2A
Where Binary Math Is Used
- IP addressing — Subnetting requires binary AND operations on IP addresses and subnet masks
- File permissions — Unix chmod: 755 = 111 101 101 (rwx r-x r-x)
- Color codes — #FF0000 = 11111111 00000000 00000000 (full red)
- Data storage — 1 byte = 8 bits = values 0-255
- Bitwise flags — Feature flags: 0b1010 = features 2 and 4 enabled
- Competitive programming — Bit manipulation problems in coding contests
Two's Complement: How Computers Handle Negative Numbers
In two's complement, the most significant bit (MSB) represents the sign: 0 = positive, 1 = negative.
To negate a number
Invert all bits, then add 1: 5 = 0101 → invert → 1010 → add 1 → 1011 = -5
| Binary (4-bit) | Unsigned | Two's Complement |
|---|---|---|
| 0000 | 0 | 0 |
| 0111 | 7 | 7 |
| 1000 | 8 | -8 |
| 1111 | 15 | -1 |
Two's complement lets CPUs use the same addition circuit for both positive and negative numbers — no special subtraction hardware needed. This is why it became the universal standard for signed integers in all modern processors.
Bitwise Operations: AND, OR, XOR, NOT, Shift
| Operation | Symbol | Example (1010 op 1100) | Result | Common Use |
|---|---|---|---|---|
| AND | & | 1010 & 1100 | 1000 | Masking bits, IP subnetting |
| OR | | | 1010 | 1100 | 1110 | Setting flags/bits |
| XOR | ^ | 1010 ^ 1100 | 0110 | Toggle bits, simple encryption |
| NOT | ~ | ~1010 | 0101 | Inverting a mask |
| Left shift | << | 1010 << 1 | 10100 | Multiply by 2 |
| Right shift | >> | 1010 >> 1 | 0101 | Divide by 2 |
Left shift by N = multiply by 2^N. Right shift by N = divide by 2^N (integer division). x << 3 = x × 8. Much faster than actual multiplication in low-level code.
How to Use the Tool (Step by Step)
- 1
Open the Binary Calculator
Navigate to the tool on ToolsArena.
- 2
Enter Binary Numbers
Type binary values (e.g., 1011, 1101).
- 3
Choose Operation
Select addition, subtraction, multiplication, or division.
- 4
View Result
See result in binary, decimal, octal, and hexadecimal.
Frequently Asked Questions
How do I add binary numbers?+−
0+0=0, 0+1=1, 1+0=1, 1+1=10 (carry 1). Work right to left, just like decimal addition but carrying at 2 instead of 10.
How do I convert decimal to binary?+−
Repeatedly divide by 2, collect remainders bottom-up. Example: 42 → 21r0 → 10r1 → 5r0 → 2r1 → 1r0 → 0r1 → binary 101010.
What is two's complement?+−
A system for representing negative numbers in binary. To negate: invert all bits and add 1. This is how all modern CPUs handle signed integers.
How do I convert binary to hex quickly?+−
Group binary digits into 4-bit chunks from right, convert each chunk: 0000=0, 0001=1, ..., 1010=A, 1111=F. Example: 10101100 → 1010 1100 → AC.
Why is binary important for developers?+−
Binary underpins IP subnetting, file permissions, bitwise operations, color codes, and low-level programming. Understanding it is essential for networking, systems programming, and competitive coding.
Is this tool free?+−
Yes. Runs entirely in your browser. No data sent anywhere.
Calculate Binary Math Instantly
Add, subtract, multiply binary numbers. Convert between binary, decimal, octal, hex.
Open Binary Calculator →Related Guides
Hex to RGB Converter Guide
Convert between Hex, RGB, RGBA, HSL, HSV, and oklch color formats. Understand color models, CSS color syntax, opacity handling, and when to use each format.
Percentage Calculator Guide
Master the three core percentage formulas with worked examples, a quick-reference table, and India-specific applications like GST and discounts.
Free Online Scientific Calculator — Complete Guide (2026)
Free scientific calculator — trigonometry, logarithms, exponents, roots, factorials. Any device.