Binary and Hex Calculator
Add, subtract, multiply and divide in binary, octal, hex or any base. Each sum is laid out as on paper, with the carries, borrows and partial products, and fractions are exact.
How to Use
- Choose the base: binary, octal, decimal, hex, or Other for any base from 2 to 36.
- Choose the operation: add, subtract, multiply or divide.
- Type both numbers in that base. Fractions (101.11) and negative numbers work too.
- Read the answer in your base and in decimal; the drawing sets out the working as you would on paper.
- For division of whole numbers you also get the quotient and remainder.
Worked Example
1011 + 110 in binary. Line them up on the right and add each column, carrying when a column reaches 2. Rightmost: 1 + 0 = 1. Next: 1 + 1 = 10, write 0 and carry 1. Next: 0 + 1 + 1 = 10, write 0, carry 1. Next: 1 + 0 + 1 = 10, write 0, carry 1. The last carry becomes the leading digit: 10001. Check in decimal: 11 + 6 = 17 = 16 + 1.
1011 × 101 in binary. Each digit of 101 gives a partial product: 1 × 1011 = 1011, 0 × 1011 = 0 (shifted one place), and 1 × 1011 shifted two places = 101100. Add them: 1011 + 101100 = 110111, which is 11 × 5 = 55.
The common mistake: carrying 10 instead of 2. In binary, 1 + 1 is not 2 written as one digit; it is 10, so you write 0 and carry 1. In hex the carry comes at 16: F + 1 = 10, not 16. Treating the digits as decimal gives answers that look plausible and are wrong.
Show Work
Formulas
Arithmetic Without Ten Fingers
The column method works in every base because it only relies on place value: a carry moves one unit of the base into the next column. Leibniz worked out binary addition, subtraction, multiplication and division in his 1703 paper and admired how simple the tables were: the binary multiplication table has only four entries.
That simplicity is why computers use binary. An adder circuit for one column needs just an XOR gate for the digit and an AND gate for the carry, and a chain of them adds whole words; multiplication in early processors such as the 6502 and Z80, which had no multiply instruction, was done in software by shifting and adding exactly as in the long multiplication above.
About This Calculator
This calculator adds, subtracts, multiplies and divides numbers written in binary, octal, decimal, hex or any base from 2 to 36, including fractions and negative numbers. It lays out the column addition or subtraction with the carries or borrows, the partial products of a multiplication, and the quotient and remainder of a division, and gives every answer in decimal, binary and hex too. It uses exact arithmetic, so long numbers are never rounded.
Everything runs in your browser; nothing is sent anywhere. For AND, OR, XOR and shifts, use the bitwise calculator.
Related calculators: Number Base Converter, Bitwise Calculator, and Two’s Complement Converter.
Frequently Asked Questions
How do you add binary numbers?
Column by column from the right, like decimal, but you carry when a column reaches 2. 0 + 0 = 0, 1 + 0 = 1, 1 + 1 = 10 (write 0, carry 1) and 1 + 1 + 1 = 11 (write 1, carry 1). 1011 + 110: 1, then 0 carry 1, 0 carry 1, 0 carry 1, and the last carry gives 10001, which is 11 + 6 = 17.
How do you subtract in binary?
Column by column, borrowing when the top digit is smaller. Borrowing takes 1 from the next column, which is worth 2 in this one, so 0 − 1 becomes 10 − 1 = 1. 1100 − 101 = 111, which is 12 − 5 = 7. Computers instead add the two’s complement of the second number.
How do you multiply in binary?
It is long multiplication with only 0 and 1, so each partial product is either zero or the first number shifted left. 1011 × 101 is 1011 + 101100 = 110111, which is 11 × 5 = 55. That shift-and-add is exactly how simple processors multiply.
How does hexadecimal addition work?
You carry when a column reaches 16. F + 1 = 10, and 1F + 2A: F + A is 15 + 10 = 25 = 16 + 9, so write 9 and carry 1; then 1 + 2 + 1 = 4. The answer is 49, which is 31 + 42 = 73 in decimal.
What happens with fractions and remainders?
Fractions are added and multiplied exactly. Division gives the exact answer, which may repeat for ever in that base, with the repeating digits marked; for whole numbers you also get the quotient and remainder: 1101 ÷ 11 = 100 remainder 1 in binary, that is 13 ÷ 3 = 4 r 1.
How do I use the Binary and Hex Calculator?
Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.
Do I need to install or sign up for anything?
Not at all — it runs in the browser with nothing to install and no account. After it loads once, it even works without an internet connection.
Is my information private?
Yes. Everything happens in your browser. Nothing you type is sent to a server or saved anywhere.
Common Use Cases
Binary homework
1011 + 110 = 10001 and 1100 − 101 = 111, with every carry and borrow drawn.
Memory addresses
0x1F + 0x2A = 0x49; 0xFF × 0xFF = 0xFE01.
Octal
777 + 1 = 1000 in octal, the way 999 + 1 rolls over in decimal.
Division
1101 ÷ 11 = 100 remainder 1 in binary; 1 ÷ 11 = 0.(01) repeats.
Last updated: