Type a number in binary, octal, decimal, hexadecimal or any base from 2 to 36 to see it in every other base at once, with the division and place-value working, fractions, and two's complement for negative numbers.
How to use the base converter
- Type the number and choose the base it's in under "From". Fractions (101.11) and negative numbers (−42) work too.
- Read the decimal, binary, octal and hex answers at once; add any other base from 2 to 36 if you need it. Copy any answer with its button.
- Pick a base under "Show the working for" to see the division, multiplication or place-value steps your textbook asks for.
How base conversion works
To decimal: each digit is worth the base raised to its position. 11101101 in binary is 1×2⁷ + 1×2⁶ + 1×2⁵ + 0×2⁴ + 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 128 + 64 + 32 + 8 + 4 + 1 = 237. Digits after the point use negative powers: 0.1 in binary is 2⁻¹ = 0.5.
From decimal: divide the whole part by the new base again and again and read the remainders upwards; multiply the fraction by the new base again and again and read the whole parts downwards. 12.375 becomes 1100 (from 12) and .011 (0.375 × 2 = 0.75 → 0, 0.75 × 2 = 1.5 → 1, 0.5 × 2 = 1.0 → 1), so 1100.011.
Between binary, octal and hex: no arithmetic is needed. One octal digit is exactly three bits and one hex digit four bits, so group the bits from the point outwards and swap each group for its digit.
Worked example: 237
237 ÷ 2 gives remainders 1, 0, 1, 1, 0, 1, 1, 1, so 237 = 11101101 in binary. Grouped in fours that is 1110 1101 = ED in hex; in threes, 011 101 101 = 355 in octal. In 8 bits it fills all eight places, so as an unsigned byte it's 237 and as a signed byte it reads as 237 − 256 = −19.
0 to 15 in binary, octal and hex
| Decimal | Binary | Octal | Hex |
|---|
| 0 | 0000 | 0 | 0 |
| 1 | 0001 | 1 | 1 |
| 2 | 0010 | 2 | 2 |
| 3 | 0011 | 3 | 3 |
| 4 | 0100 | 4 | 4 |
| 5 | 0101 | 5 | 5 |
| 6 | 0110 | 6 | 6 |
| 7 | 0111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
Everything is worked out in your browser with exact whole-number arithmetic, so long numbers keep every digit.
Frequently asked questions
How do I convert decimal to binary?
Divide the number by 2 and write down the remainder, then divide the answer by 2 again, and keep going until you reach 0. The remainders read from the last to the first are the binary number. 13 ÷ 2 = 6 r 1, 6 ÷ 2 = 3 r 0, 3 ÷ 2 = 1 r 1, 1 ÷ 2 = 0 r 1, so 13 is 1101 in binary. The converter shows this table for any number.
How do I convert binary to hexadecimal?
Group the bits in fours from the right (add zeros on the left if needed) and replace each group with one hex digit: 0000 = 0 up to 1111 = F. 11101101 becomes 1110 1101, which is E D, so ED. For octal, use groups of three: 011 101 101 is 355.
What is two's complement?
It is how computers store negative whole numbers. In n bits, −N is stored as 2ⁿ − N, which you get by writing N in binary, flipping every bit and adding 1. In 8 bits, 5 is 00000101, flipped 11111010, plus 1 is 11111011 (FB in hex). An 8-bit signed number holds −128 to 127. Choose 8, 16, 32 or 64 bits to read binary or hex input as signed.
Why does 0.1 never end in binary?
A fraction ends in a base only when its denominator's prime factors divide that base. 0.1 = 1/10 has a factor 5, which doesn't divide 2, so in binary it repeats for ever: 0.0(0011), where the digits in brackets repeat. 0.5, 0.25 and 0.375 end, because their denominators are powers of 2.
Which digits does a base above 10 use?
The digits 0–9 and then letters: A = 10, B = 11, up to Z = 35 in base 36. Hexadecimal (base 16) uses 0–9 and A–F. Letters can be typed in upper or lower case.
Can I paste numbers with 0x or 0b in front?
Yes. 0x (hex), 0b (binary) and 0o (octal) prefixes are accepted when they match the base you chose, and spaces or underscores between digits are ignored, so 0b1110_1101 and 1110 1101 both work.