Binary Converter — Binary, Octal, Decimal, Hex

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...

NUMBER BASE CONVERTER

CONVERT FROM

Binary (base 2)

101010

Octal (base 8)

52

Decimal (base 10)

42

input

Hexadecimal (base 16)

2A

Bit length

6

Bytes

1

Hex prefix

0x2A

STEP-BY-STEP

1

Decimal 42 → Binary by repeated division:

2

42 ÷ 2 = 21 remainder 0

3

21 ÷ 2 = 10 remainder 1

4

10 ÷ 2 = 5 remainder 0

5

5 ÷ 2 = 2 remainder 1

6

2 ÷ 2 = 1 remainder 0

7

1 ÷ 2 = 0 remainder 1

8

Read remainders bottom to top: 101010

QUICK EXAMPLES

BIT VISUALIZER

BIT PATTERN

Byte 1

0
7
0
6
1
5
0
4
1
3
0
2
1
1
0
0

POWERS OF 2 REFERENCE

2ⁿnDecimalHex
1011
2122
4244
8388
1641610
3253220
6466440
128712880
2568256100
5129512200
1024101024400
3276815327688000
65536166553610000
Created with❤️byeaglecalculator.com

FORMULAS

NUMBER BASE CONVERSION REFERENCE
NAMEFORMULADESCRIPTION
Binary to decimalSum of (bit × 2^position) for each bit1010 = 1×8 + 0×4 + 1×2 + 0×1 = 10
Decimal to binaryRepeated division by 2, read remainders bottom-up10 ÷ 2 = 5 r0, 5 ÷ 2 = 2 r1, 2 ÷ 2 = 1 r0, 1 ÷ 2 = 0 r1 → 1010
Hex to decimalSum of (digit × 16^position) for each digitFF = 15×16 + 15×1 = 255
Binary to hexGroup bits in 4 from right, convert each group1010 1111 → A F → AF
Octal to decimalSum of (digit × 8^position) for each digit77 = 7×8 + 7×1 = 63
Bit lengthfloor(log2(n)) + 1 bitsNumber of bits needed to represent n
Byte countceil(bit_length / 8) bytesNumber of bytes needed
Hex prefix0x prefix: 0xFF = 255Convention: 0b for binary, 0o for octal, 0x for hex

HOW TO USE

  1. 1

    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).

  2. 2

    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.

  3. 3

    The result table shows your number in all four bases simultaneously. Click any Copy button to copy that representation to clipboard.

  4. 4

    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.

  5. 5

    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).

WORKED EXAMPLE

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.

FREQUENTLY ASKED QUESTIONS

RELATED CALCULATORS

MORE NUMBER THEORY CALCULATORS

Was this calculator helpful?

Last updated: April 29, 2026 · Formula verified by EagleCalculator team · Eagle-eyed accuracy for every calculation.