How binary numbers work
Decimal uses ten digits, with place values 1, 10, 100 and so on. Binary uses two digits, with place values 1, 2, 4, 8, 16, 32 …. So 1101₂ = 8 + 4 + 0 + 1 = 13. To convert a decimal number to binary, divide by 2 repeatedly and read the remainders from bottom to top: 13 ÷ 2 = 6 r 1, 6 ÷ 2 = 3 r 0, 3 ÷ 2 = 1 r 1, 1 ÷ 2 = 0 r 1, which gives 1101.
| Decimal | Binary | Hex |
|---|---|---|
| 5 | 101 | 5 |
| 10 | 1010 | A |
| 16 | 10000 | 10 |
| 255 | 11111111 | FF |
Binary arithmetic
- Addition: 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1). For 1010 + 0110: the result is 10000.
- Subtraction: borrow as in decimal, so 10000 − 0110 = 1010.
- Multiplication: shift and add. 101 × 11 = 1111 (5 × 3 = 15).
- Division: long division in base 2. 1111 ÷ 10 = 111 remainder 1.
Bitwise operations
| Operation | Rule | 1100 and 1010 |
|---|---|---|
| AND | 1 only if both bits are 1 | 1000 |
| OR | 1 if either bit is 1 | 1110 |
| XOR | 1 if the bits differ | 0110 |
| Shift left by n | Multiply by 2ⁿ | 1 << 3 = 1000 |
Bitwise operations are used for flags, masks, permissions and low-level programming. For hexadecimal work try the hex calculator, and see the big number calculator for huge values.
Complete guide to the Binary Calculator
How to use the Binary Calculator, step by step
- Choose the base of the numbers you type.
- Enter the first number.
- Choose an operation and a second number.
- Read the result in every base.
Common mistakes to avoid
- Typing a digit that is not valid in the base.
- Mixing up bitwise AND with addition.
- Forgetting that results can be negative.
Key terms explained
- Bit
- One binary digit.
- Byte
- Eight bits.
- Bitwise
- Working on each bit of a number.
- Base
- The number of digits in a number system.
Want the full walkthrough? Read our guide: How Binary and Hexadecimal Work (Conversion and Arithmetic).
Frequently asked questions
How do I convert binary to decimal?
Multiply each digit by its place value, a power of 2, and add. For 1101: 1×8 + 1×4 + 0×2 + 1×1 = 13.
How do I convert decimal to binary?
Divide by 2 repeatedly, noting each remainder, then read the remainders from last to first. For 13 this gives 1101.
What is 1 + 1 in binary?
1 + 1 = 10 in binary, which is two in decimal. You write 0 and carry 1 to the next place.
Why do computers use binary?
Electronic circuits have two stable states, on and off, which map neatly to 1 and 0. This makes binary reliable and simple to implement in hardware.
What is a bit and a byte?
A bit is one binary digit. A byte is 8 bits and can hold 256 different values, from 0 to 255.
How are negative numbers stored in binary?
Computers usually use two’s complement. This calculator shows negative results with a minus sign instead, which is simpler to read.
What is XOR used for?
XOR returns 1 when the bits differ. It is used in checksums, encryption, toggling flags and swapping values without extra storage.