The Binary Converter converts any number between binary (base 2), octal (base 8), decimal (base 10), and hexadecimal (base 16) instantly. Select your input base, type the number, and all four conversions appear simultaneously. Step-by-step working shows the repeated division method for decimal-to-bi...
CONVERT FROM
Binary (base 2)
101010
Octal (base 8)
52
Decimal (base 10)
42
Hexadecimal (base 16)
2A
Bit length
6
Bytes
1
Hex prefix
0x2A
STEP-BY-STEP
Decimal 42 → Binary by repeated division:
42 ÷ 2 = 21 remainder 0
21 ÷ 2 = 10 remainder 1
10 ÷ 2 = 5 remainder 0
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
Read remainders bottom to top: 101010
QUICK EXAMPLES
BIT PATTERN
Byte 1
POWERS OF 2 REFERENCE
| 2ⁿ | n | Decimal | Hex |
|---|---|---|---|
| 1 | 0 | 1 | 1 |
| 2 | 1 | 2 | 2 |
| 4 | 2 | 4 | 4 |
| 8 | 3 | 8 | 8 |
| 16 | 4 | 16 | 10 |
| 32 | 5 | 32 | 20 |
| 64 | 6 | 64 | 40 |
| 128 | 7 | 128 | 80 |
| 256 | 8 | 256 | 100 |
| 512 | 9 | 512 | 200 |
| 1024 | 10 | 1024 | 400 |
| 32768 | 15 | 32768 | 8000 |
| 65536 | 16 | 65536 | 10000 |
| NAME | FORMULA | DESCRIPTION |
|---|---|---|
| Binary to decimal | Sum of (bit × 2^position) for each bit | 1010 = 1×8 + 0×4 + 1×2 + 0×1 = 10 |
| Decimal to binary | Repeated division by 2, read remainders bottom-up | 10 ÷ 2 = 5 r0, 5 ÷ 2 = 2 r1, 2 ÷ 2 = 1 r0, 1 ÷ 2 = 0 r1 → 1010 |
| Hex to decimal | Sum of (digit × 16^position) for each digit | FF = 15×16 + 15×1 = 255 |
| Binary to hex | Group bits in 4 from right, convert each group | 1010 1111 → A F → AF |
| Octal to decimal | Sum of (digit × 8^position) for each digit | 77 = 7×8 + 7×1 = 63 |
| Bit length | floor(log2(n)) + 1 bits | Number of bits needed to represent n |
| Byte count | ceil(bit_length / 8) bytes | Number of bytes needed |
| Hex prefix | 0x prefix: 0xFF = 255 | Convention: 0b for binary, 0o for octal, 0x for hex |
Select the base of your input number: Binary (base 2, digits 0-1), Octal (base 8, digits 0-7), Decimal (base 10, digits 0-9), or Hexadecimal (base 16, digits 0-9 and A-F).
Type your number in the input box. The converter validates as you type — the border turns red if you enter an invalid digit for the selected base. All four conversions appear instantly.
The result table shows your number in all four bases simultaneously. Click any Copy button to copy that representation to clipboard.
The bit visualiser on the right shows the binary representation as individual bit cells, colour-coded black for 1 and grey for 0. Bit position numbers are shown below each cell.
The step-by-step panel shows the conversion process — for decimal input it shows repeated division by 2, for binary it shows the positional expansion (each bit × its power of 2).
42 decimal to binary: 42÷2=21 r0, 21÷2=10 r1, 10÷2=5 r0, 5÷2=2 r1, 2÷2=1 r0, 1÷2=0 r1. Read bottom-up: 101010. 42 = 101010 binary = 2A hex = 52 octal. Verification: 32+0+8+0+2+0=42 ✓. 255 = 11111111 binary = FF hex = 377 octal.
Hexadecimal Converter
Calculate instantly →
2 in Binary
Calculate instantly →
4 in Binary
Calculate instantly →
Random Number Generator
Calculate instantly →
8 in Binary
Calculate instantly →
16 in Binary
Calculate instantly →
10 in Binary
Calculate instantly →
1 in Binary
Calculate instantly →
255 in Binary
Calculate instantly →
3 in Binary
Calculate instantly →
6 in Binary
Calculate instantly →
9 in Binary
Calculate instantly →
11 in Binary
Calculate instantly →
14 in Binary
Calculate instantly →
128 in Binary
Calculate instantly →
0 in Binary
Calculate instantly →
5 in Binary
Calculate instantly →
7 in Binary
Calculate instantly →
12 in Binary
Calculate instantly →
Last updated: April 29, 2026 · Formula verified by EagleCalculator team · Eagle-eyed accuracy for every calculation.