All posts

How to convert Decimal to Binary

Conversion factor and calculation steps from Decimal (dec) to Binary (bin).

Open online converter

Conversion logic

The number is first converted to decimal as digits × radixⁿ, then to the selected base by division with remainder. Prefixes 0x, 0b, 0o and digit grouping with spaces or _ are allowed.

dec: digits 0 1 2 3 4 5 6 7 8 9, radix 10

bin: digits 0 1, radix 2

255 ÷ 2 = 127 remainder 1 (1)

127 ÷ 2 = 63 remainder 1 (1)

63 ÷ 2 = 31 remainder 1 (1)

31 ÷ 2 = 15 remainder 1 (1)

15 ÷ 2 = 7 remainder 1 (1)

7 ÷ 2 = 3 remainder 1 (1)

3 ÷ 2 = 1 remainder 1 (1)

1 ÷ 2 = 0 remainder 1 (1)

255₁₀ = 11111111₂