Arvutaja

Number base converter

A number system's base says how many distinct digit symbols it uses: ten in decimal, two in binary, and sixteen in hexadecimal, where values above nine are written with the letters A to F.

Binary (base 2)
11111111
Octal (base 8)
377
Hexadecimal (base 16)
FF

Rates and thresholds

255 in decimal
hex FF
255 in binary
11111111
A–F
10–15

How do I convert decimal to binary?

Divide repeatedly by two and read the remainders backwards. For 13: 13 ÷ 2 = 6 remainder 1, 6 ÷ 2 = 3 remainder 0, 3 ÷ 2 = 1 remainder 1, 1 ÷ 2 = 0 remainder 1 — read from the last division upward, the remainders give 1101. Check it: 8 + 4 + 0 + 1 = 13.

Why is hexadecimal used in programming?

Because one hex digit maps to exactly four bits, so a byte fits in two characters: 11111111 is simply FF. Binary is right for the machine but long and error-prone for people; hex carries the same information four times more compactly. Colour codes like #1E5FD9 come from the same convention.

Related calculators

All calculators