Binary Calculator
Convert between binary, octal, decimal and hexadecimal, and add, subtract, multiply, divide or AND, OR, XOR numbers.
Your number
Filled in with example values. Replace them with your own.
Whole numbers of 0 or more, up to 256 bits. Spaces, underscores and 0b, 0o or 0x prefixes are fine.
Results update as you type.
Result
Binary: 1111 1111
In binary
1111 1111
Binary · base 2
1111 1111
Octal · base 8
377
Decimal · base 10
255
Hexadecimal · base 16
FF
How it works
Place values
each digit × 10^position, added up = 255 in decimal
Into binary
divide by 2 repeatedly, read the remainders upwards = 1111 1111
How the binary calculator works
Enter a whole number in binary, octal, decimal or hexadecimal and see it in all four. Or pick Calculate to add, subtract, multiply or divide two numbers, or combine them with AND, OR and XOR.
Every digit is kept exactly, for numbers up to 256 bits long.
Place values
Each digit is worth the base raised to the power of its position, counting from 0 on the right:
1010₂ = 1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 10
FF₁₆ = 15×16¹ + 15×16⁰ = 255
777₈ = 7×8² + 7×8¹ + 7×8⁰ = 511
Worked examples
- 255 in binary is 1111 1111, in octal 377 and in hexadecimal FF.
- 1010 + 0110 = 10 + 6 = 16 = 10000 in binary (shown as 0001 0000).
- 17 ÷ 5 = 3 remainder 2.
Notes
- Whole numbers of 0 or more as input; results of subtraction can be negative.
- Division gives the whole-number quotient and the remainder.
Frequently asked questions
How do I convert decimal to binary by hand?
Divide the number by 2 and write down the remainder (0 or 1). Keep dividing the result by 2 until you reach 0, then read the remainders from the last to the first. For 10: 10 → 5 r0 → 2 r1 → 1 r0 → 0 r1, so 10 is 1010.
Why is hexadecimal used so much?
Each hexadecimal digit stands for exactly four binary digits, so long binary numbers become short and easy to read: 1111 1111 is FF. Octal digits stand for three binary digits each.
What do AND, OR and XOR do?
They compare two numbers bit by bit. AND gives 1 only where both bits are 1, OR where either is 1, and XOR where exactly one is 1. For example, 1100 AND 1010 = 1000.
How are negative numbers shown?
With a minus sign. Computers often store negative numbers in two’s complement, which depends on a fixed number of bits; this calculator shows the plain signed value instead.