Number Base Converter

Convert whole numbers between binary, octal, decimal, hexadecimal or any base from 2 to 36.

Digits 0–9 then letters A–Z for bases above 10

2 binary · 8 octal · 10 decimal · 16 hex

Base 2

11111111

Binary (base 2)
1111 1111
Octal (base 8)
377
Decimal (base 10)
255
Hexadecimal (base 16)
FF
Bits needed
8

How it works

A number base (radix) sets how many digits are used before carrying to the next place. Decimal uses 10 digits; binary uses 2 (0 and 1); hexadecimal uses 16 (0–9 then A–F). Bases above 10 continue with letters up to Z for base 36.

To convert, the number is first read into its value (each digit times the base raised to its position) then repeatedly divided by the target base, collecting remainders as the new digits. Big-integer math keeps very long numbers exact.

Formula

value = Σ dᵢ × base^i; to convert, divide by the new base repeatedly and read the remainders in reverse

Questions people ask

How do I convert decimal to binary by hand?

Divide by 2 repeatedly and write down the remainders, then read them bottom to top. 13 → 6 r1 → 3 r0 → 1 r1 → 0 r1, so 13 = 1101.

Why do programmers use hexadecimal?

Each hex digit represents exactly 4 bits, so a byte is always two hex digits (00–FF). It is far more compact than binary and easy to convert.

What does 0x mean before a number?

It is a prefix marking hexadecimal, as in 0xFF = 255. Similarly 0b marks binary and 0o marks octal. You can type these prefixes here.