Binary Calculator

Add, subtract, multiply, and divide binary numbers, convert between binary, decimal, and hex, run bitwise operations, and build binary numbers visually with a clickable bit grid.

Binary Arithmetic
Binary ↔ Decimal ↔ Hex
Bitwise (AND / OR / XOR / NOT)
Visual Bit Grid

Type in any field, the others update automatically.

Click a bit to toggle it on or off. Watch the decimal value update as you build the number.

All calculations run in your browser. Nothing is sent to a server.

Most binary calculators handle the same list: arithmetic, conversion between number systems, and bitwise logic. This one covers all of that, plus a fourth mode most competitors don't offer: a clickable bit grid that lets you build a binary number visually, bit by bit, and see the place value and running decimal total update as you go. It's a genuinely different way to learn how binary place value works, rather than just typing a number and reading an answer.

Related Calculators

How Each Mode Works

1. Binary Arithmetic

Binary addition, subtraction, multiplication, and division follow the same logic as base-10 arithmetic, just with only two digits available. Addition carries over at 2 instead of 10: 1 + 1 = 10 in binary, the same idea as 9 + 1 = 10 in decimal.

1010 (10) + 0110 (6) = 10000 (16)

2. Binary, Decimal, Hex, and Octal Conversion

Every number system represents the same value using a different base. Binary is base 2, decimal is base 10, octal is base 8, and hexadecimal is base 16. Converting between them means re-expressing the same quantity using a different set of place values.

Binary 101101 = Decimal 45 = Hex 2D = Octal 55

3. Bitwise Operations

Bitwise operations compare binary numbers one bit position at a time rather than treating them as a single value. AND returns 1 only where both bits are 1. OR returns 1 where either bit is 1. XOR returns 1 where the bits differ. NOT flips every bit. Shifting moves every bit left or right by one position, which is the same as multiplying or dividing by 2.

1010 AND 0110 = 0010
1010 OR 0110 = 1110
1010 XOR 0110 = 1100

4. Visual Bit Grid

Each bit in a binary number represents a power of 2, and its position determines how much it contributes to the total value. The grid shows eight bit positions with their place values labeled underneath, so toggling a bit on shows exactly how much it adds to the decimal total. This is the same underlying idea as long division for decimal-to-binary conversion, just made visible and interactive rather than done on paper.

Why Computers Use Binary

Binary works well for electronics because a circuit only needs to distinguish between two states: on or off, high voltage or low voltage. Representing numbers with only two digits maps directly onto that physical reality, whereas base-10 would require ten distinguishable voltage levels instead of two, which is far less reliable at the hardware level. This is also why bytes (groups of 8 bits) became the standard unit of memory: 8 bits can represent 256 distinct values, from 0 to 255, which is enough to cover a standard character set with room to spare.

Where Binary Actually Comes Up

Programming and Software Development

Bitwise operations show up constantly in real code: permission flags (checking if a user has read, write, or execute access packed into a single number), fast multiplication or division by powers of 2 using shifts, and low-level data manipulation in languages like C, Python, or JavaScript. A developer debugging a permissions system or working with binary flags needs to be comfortable reading AND, OR, and XOR results at a glance rather than working them out by hand each time.

Networking

IP addresses and subnet masks are binary numbers underneath their familiar decimal-dotted appearance. Working out which devices belong to the same subnet, or converting a subnet mask like 255.255.255.0 into its binary form, is a direct application of the binary-to-decimal conversion covered above, just applied four bytes at a time.

Computer Science Coursework

Binary is usually one of the first topics covered in an introductory computer science or digital electronics course, since it underlies everything from memory addressing to how characters and images are stored. Working through conversions and bitwise logic by hand a few times, and then checking the result, builds the intuition that's needed before moving on to hexadecimal, two's complement, or floating-point representation.

Digital Electronics and Logic Design

Logic gates in digital circuits are physical implementations of the same AND, OR, XOR, and NOT operations covered here. Anyone designing or troubleshooting a circuit needs to predict what a combination of gates will output for a given input, which is exactly what the bitwise mode above calculates.

Binary Reference: Powers of 2

Bit position Place value Binary
0100000001
1200000010
2400000100
3800001000
712810000000

Common Mistakes

Reading binary digits as if they were decimal. The binary number 10 is not "ten," it's the decimal value 2. Each position represents a power of 2, not a power of 10.
Forgetting to carry during binary addition. 1 + 1 in binary is 10, not 2 or 11. Missing the carry is the most common source of errors when adding binary numbers by hand.
Confusing bitwise OR with addition. 1010 OR 0110 is 1110, not the sum of the two numbers. Bitwise operations compare individual bit positions and don't produce the same result as arithmetic.
Assuming NOT simply reverses the digits. NOT flips every bit (0 becomes 1, 1 becomes 0) within a fixed number of bits. Without agreeing on how many bits to use, a NOT result is ambiguous, since leading zeros also flip.

Frequently Asked Questions

How do I convert a binary number to decimal?

Multiply each digit by the power of 2 matching its position (starting from 0 on the right), then add the results together. The "Binary ↔ Decimal ↔ Hex" mode above does this instantly and shows the equivalent in hex and octal too.

What's the difference between AND, OR, and XOR?

AND returns 1 only when both bits are 1. OR returns 1 when at least one bit is 1. XOR returns 1 only when the bits are different from each other. These distinctions matter in programming, digital logic design, and networking.

Why do computers use binary instead of decimal?

Binary maps directly onto the two physical states an electronic circuit can reliably distinguish: on and off. Building hardware that reliably tells apart ten voltage levels for a decimal system would be far less practical than distinguishing just two.

What is a bit shift used for?

Shifting a binary number left is equivalent to multiplying by 2, and shifting right is equivalent to dividing by 2 (rounding down). This is commonly used in programming for fast multiplication and division by powers of 2.

How does the visual bit grid help me understand binary?

Each bit position has a fixed place value (1, 2, 4, 8, and so on). Clicking bits on and off shows which place values are being added together to form the total, which is the core idea behind how any binary number is built.

|