Binary Calculator
Add, subtract, multiply, divide and AND/OR/XOR/NOT in binary, octal, decimal or hex.
About this tool
Pick the input base, type two numbers and choose an operation. The result appears in binary, octal, decimal and hexadecimal, each with a copy button. Negative results and NOT also show two's complement in the word size you choose (8, 16, 32 or 64 bits). Numbers can be as long as you like.
Binary arithmetic and bitwise operations
Binary arithmetic follows the same rules as decimal, with only the digits 0 and 1, so you carry whenever a column reaches two. 1011 + 110 is 10001, which is 11 + 6 = 17. Programmers also use bitwise operations, which compare numbers one bit at a time. AND keeps a bit only where both inputs have it (1100 AND 1010 = 1000), which is how a mask picks out flags. OR sets a bit where either input has it, which is how you combine flags. XOR sets a bit where exactly one input has it, which is useful for toggling bits and simple checksums. Shifting left by n bits multiplies by 2โฟ, and shifting right divides by 2โฟ, dropping the remainder. NOT flips every bit, so the answer depends on the word size. Computers store negative integers in two's complement: flip the bits of the positive number and add one. That makes โ1 in 8 bits 11111111, and lets ordinary adder circuits handle subtraction. Because the tool uses arbitrary-precision integers, results never overflow, unlike 32-bit or 64-bit variables in code. Honest limits: whole numbers only, and division gives the whole-number quotient with the remainder shown separately. The number base converter, the binary translator and the IEEE-754 converter are related, and Binary, explained from zero covers the basics.
Frequently asked questions
How do you add binary numbers?
Add column by column from the right: 0+0=0, 1+0=1, 1+1=10 (write 0, carry 1). For example, 1011 + 110 = 10001.
What is two's complement?
The usual way to store negative integers: invert all the bits of the positive value and add 1. โ1 in 8 bits is 11111111.
Can it do hexadecimal maths?
Yes. Choose Hex as the input base. Results are shown in every base.
Is my input sent anywhere?
No. All calculations run in your browser and nothing is stored or sent.