Loading calculator...
Loading calculator...
Convert numbers between binary, octal, decimal, and hexadecimal. Perform bitwise operations: AND, OR, XOR, NOT.
Number Bases:
Binary (Base 2): digits 0-1 — each position is a power of 2
Octal (Base 8): digits 0-7 — each position is a power of 8
Hex (Base 16): digits 0-9, A-F — each position is a power of 16
Bitwise:
AND: 1 only if both bits are 1. OR: 1 if either bit is 1. XOR: 1 if bits differ. NOT: flip all bits.
Binary is a base-2 number system using only 0 and 1. Each digit position represents a power of 2 (1, 2, 4, 8, 16...). Computers use binary internally because transistors have two states: on (1) and off (0).
Multiply each binary digit by the corresponding power of 2 and sum them. For example, 1011 = (1×8) + (0×4) + (1×2) + (1×1) = 8 + 0 + 2 + 1 = 11 in decimal.
Hexadecimal (base 16) is used in programming because each hex digit represents exactly 4 binary bits. It makes binary data more readable. Memory addresses, HTML colors (#FF5733), and byte values are often shown in hex.
AND compares each pair of bits and outputs 1 only if both are 1. Example: 12 AND 10 = 1100 AND 1010 = 1000 = 8. It is used to mask bits (keep specific bits, clear others).
XOR (exclusive OR) outputs 1 when bits differ. XOR is used in cryptography, checksums, and toggling bits. A useful property: XOR-ing a number with itself always gives 0, useful for detecting duplicates.