How it is calculated
In a positional number system with base b, every digit is worth b times as much as the one to its right. Binary (b = 2) only uses the digits 0 and 1; hexadecimal (b = 16) uses 0–9 and A–F for the values 10 to 15.
1011₂ = 1·2³ + 0·2² + 1·2¹ + 1·2⁰ = 11₁₀
To go the other way, divide the decimal number by the base again and again; the remainders read from bottom to top are the digits. One hex digit is exactly four bits, one octal digit three bits.
Two’s complement is how computers store negative numbers: invert all bits and add 1. The converter picks the smallest width that fits: 8, 16, 32 or 64 bits.
Example
The decimal number 100 is 0110 0100 in binary, 144 in octal and 64 in hex.
Frequently asked questions
How do I convert decimal to binary?
Divide the number by 2 repeatedly and write down each remainder. 13 ÷ 2 = 6 r 1, 6 ÷ 2 = 3 r 0, 3 ÷ 2 = 1 r 1, 1 ÷ 2 = 0 r 1. Reading from bottom to top gives 1101.
How do I convert hex to binary?
Replace every hex digit with its four bits: A = 1010, F = 1111. So 0xAF becomes 1010 1111.
Why do programmers use hexadecimal?
One byte (8 bits) fits exactly into two hex digits. That is why memory addresses, colour codes like #FF8800, character codes and bit masks are usually written in hex.
Can I convert numbers with decimals?
No, the converter works with whole numbers – but they can be as large as you like, far beyond 64 bits.