Skip to content

Number base converter

Convert whole numbers between binary, octal, decimal and hexadecimal, with the place values and the division steps shown.

Whole numbers up to 9,007,199,254,740,991. Prefixes 0x, 0b and 0o are fine.

Results

In binary 0111 1110 1010

How it works

value = Σ digit × base^position

In any base, each digit is worth the base raised to its position, counting from 0 on the right: binary 1011 is 1×2³ + 0×2² + 1×2¹ + 1×2⁰ = 11. To go the other way, divide by the new base again and again; the remainders, read from the last to the first, are the digits. Hexadecimal uses A–F for 10–15, and each hex digit is exactly four binary digits, which is why programmers like it.

  1. Place values into decimal, then divide by the new base (read the remainders upward) 2026 ÷ 2 = 1013 r 0 1013 ÷ 2 = 506 r 1 506 ÷ 2 = 253 r 0 253 ÷ 2 = 126 r 1 126 ÷ 2 = 63 r 0 63 ÷ 2 = 31 r 1 31 ÷ 2 = 15 r 1 15 ÷ 2 = 7 r 1 7 ÷ 2 = 3 r 1 3 ÷ 2 = 1 r 1 1 ÷ 2 = 0 r 1