Number Base Converter
Convert numbers between binary, octal, decimal, hexadecimal, and any base from 2 to 36, with the repeated-division working shown step by step.
Como usar esta calculadora
- 1Type the value using digits valid in its base — hexadecimal uses 0–9 and A–F.
- 2Choose which base the value is currently in.
- 3Optionally set a target base from 2 to 36; binary, octal, decimal, and hex are always shown.
Como funciona
Converting between bases
To decimal: sum each digit × base^position, counting positions from 0 on the right From decimal: divide by the target base repeatedly, reading remainders bottom to top Binary ↔ hex: each hex digit is exactly four binary digits Binary ↔ octal: each octal digit is exactly three binary digits
Any positional number system works the same way: the value of a digit is the digit itself multiplied by the base raised to its position. Converting to decimal is that sum. Converting from decimal is the reverse — repeatedly divide by the target base and collect the remainders, which come out in reverse order. Because 16 and 8 are powers of 2, hex and octal map onto binary in fixed-size groups with no arithmetic at all.
Exemplo resolvido
255 in decimal converts to hexadecimal by repeated division: 255 ÷ 16 = 15 remainder 15 (F), then 15 ÷ 16 = 0 remainder 15 (F). Reading the remainders bottom to top gives FF. In binary, 255 is 11111111 — eight ones, the largest value a single byte can hold.
Number Base Converter: o guia completo
Why computing uses hexadecimal
Computers work in binary, but binary is unreadable at length — a single 32-bit value is 32 characters of ones and zeros. Hexadecimal compresses it four-to-one because 16 is 2⁴, so every hex digit maps to exactly four bits with no arithmetic required.
That is why colours are written #FF5733, memory addresses are 0x7FFE, and MAC addresses use hex pairs. Each pair of hex digits is exactly one byte, which makes hex the natural notation any time you are looking at raw memory or binary data.
Octal serves the same role for three-bit groups and survives mainly in Unix file permissions, where 755 means read-write-execute for the owner and read-execute for everyone else.
The repeated division method
To convert a decimal number into any base by hand, divide by the target base and write down the remainder. Divide the quotient by the base again, note that remainder, and keep going until the quotient reaches zero. Reading the remainders from last to first gives the answer.
The step panel above shows exactly this working. It is worth doing once by hand because it makes clear why the remainders come out backwards — each division peels off the least significant digit first.
Powers of two are worth memorising
Certain values recur constantly in computing because they mark the boundaries of what fits: 255 is the largest unsigned 8-bit value (FF in hex), 65,535 the largest 16-bit (FFFF), and 4,294,967,295 the largest 32-bit (FFFFFFFF).
Recognising these on sight makes debugging faster. A count that mysteriously stops at 255 has overflowed a byte; a file size limit at 4,294,967,296 bytes is a 32-bit address space. Both are immediately obvious once the numbers are familiar.
Perguntas frequentes
How do I convert decimal to binary?
Divide by 2 repeatedly and record each remainder, then read the remainders from last to first. 13 gives remainders 1, 0, 1, 1 reading upward, so 13 is 1101 in binary. The step panel above shows this working for whatever base you choose.
What does 0x mean before a number?
It is a prefix marking a hexadecimal literal, used in C, JavaScript, Python, and most other languages. 0b marks binary and 0o marks octal. This converter accepts and ignores all three prefixes, so you can paste values straight from code.
Why does hexadecimal use letters?
Base 16 needs sixteen distinct digits, and only ten numerals exist. A through F fill positions 10 to 15. The same convention extends upward, which is why base 36 — the maximum here — uses every digit and every letter of the alphabet.
Can this convert fractions or negative numbers?
No, whole non-negative numbers only. Fractional base conversion requires repeated multiplication of the fractional part and often produces a repeating expansion, and negative numbers in binary depend on the representation used — two's complement, sign-magnitude, or offset.