About the binary calculator
The binary calculator adds, subtracts, multiplies and divides numbers written in base 2, and converts between binary and decimal. Every answer is also shown in decimal and hexadecimal so you can see how the representations relate.
Binary is how computers store numbers, so this tool is useful for programming, digital electronics and computer science courses.
Who should use the binary calculator
- Computer science students and learners.
- Programmers checking bit patterns.
- Electronics hobbyists working with logic and registers.
How to use the binary calculator: what each input means
- Operation
- Add, subtract, multiply, divide, or convert between binary and decimal.
- Binary numbers
- Digits 0 and 1 only. Spaces between groups of bits are ignored, and a leading minus sign is allowed.
How the binary calculator works: method and formula
The calculator converts each binary string to an exact integer, performs the operation with arbitrary-precision arithmetic and converts the answer back to binary. Division gives the quotient and remainder as well as a fractional binary expansion.
- Binary to decimal
- d = Σ bit × 2^position (position 0 is the rightmost bit)
How to read your binary calculator result
Negative results use a minus sign rather than two's complement, so the digits are easy to read. If you need a fixed-width two's complement form, convert the decimal result yourself for the width you want.
Binary Calculator worked example
Add 1101 and 101 in binary.
- 1101 in binary is 8 + 4 + 0 + 1 = 13.
- 101 in binary is 4 + 0 + 1 = 5.
- 13 + 5 = 18, which is 10010 in binary.
- For comparison, 1101 − 101 = 1000 and 1101 × 101 = 1000001.
1101 + 101 = 10010 (decimal 18).
Practical uses of the binary calculator
- Learning how binary addition carries work.
- Checking a bit pattern in code.
- Converting a decimal value to binary quickly.
Assumptions and limitations of this calculator
- Unsigned magnitudes with a sign. It does not model fixed-width overflow or two's complement arithmetic.
- Binary fractions in input are not accepted; division results show a limited number of fractional bits.
