Binary Calculator
Convert between binary, decimal, hex, and octal number systems
Result
—
Related Calculators
Frequently Asked Questions
How do I convert decimal to binary?
Divide by 2 repeatedly, writing down the remainders from bottom to top. Example: 13 ÷ 2 = 6 R1, 6 ÷ 2 = 3 R0, 3 ÷ 2 = 1 R1, 1 ÷ 2 = 0 R1. Reading remainders bottom-up: 1101. Verify: 8+4+0+1 = 13. Each bit represents a power of 2: 2^3+2^2+2^0 = 8+4+1 = 13.
What is hexadecimal and why is it used?
Hexadecimal (base 16) uses digits 0-9 and A-F. One hex digit represents exactly 4 binary bits (a nibble), and two hex digits = 1 byte (8 bits). So FF hex = 11111111 binary = 255 decimal. Hex is compact: the 24-bit color #FF6B35 is much shorter than its 24-digit binary equivalent.
How do I count in binary?
Binary uses only 0 and 1. Counting: 0, 1, 10, 11, 100, 101, 110, 111, 1000... Each position is a power of 2. To read binary 1010: 1x8 + 0x4 + 1x2 + 0x1 = 10. With n bits you can represent 0 to 2^n - 1: 8 bits = 0-255, 16 bits = 0-65535, 32 bits = 0-4,294,967,295.
What are AND, OR, XOR operations?
These are bitwise operations on binary numbers. AND (both must be 1): 1010 AND 1100 = 1000. OR (either can be 1): 1010 OR 1100 = 1110. XOR (exactly one must be 1): 1010 XOR 1100 = 0110. NOT (flip all bits): NOT 1010 = 0101. Used in programming for bit manipulation, flags, and masks.
What is two complement representation?
Two complement is how computers store negative integers. To negate: flip all bits and add 1. Example: 5 = 00000101, -5 = 11111010 + 1 = 11111011. Benefits: addition works the same way for positive and negative. 8-bit two complement: range is -128 to +127.
Binary Place Values
| Bit position | Power of 2 | Value |
|---|---|---|
| Bit 0 (2^0) | 2^0 | 1 |
| Bit 1 (2^1) | 2^1 | 2 |
| Bit 2 (2^2) | 2^2 | 4 |
| Bit 3 (2^3) | 2^3 | 8 |
| Bit 4 (2^4) | 2^4 | 16 |
| Bit 5 (2^5) | 2^5 | 32 |
| Bit 6 (2^6) | 2^6 | 64 |
| Bit 7 (2^7) | 2^7 | 128 |