Number Base Converter
Convert numbers between decimal, binary, hexadecimal, octal and any base from 2 to 36 – with two’s complement for signed values.
How positional systems work
In base b each digit is multiplied by a power of b. In binary (base 2), 11111101010 = 1024 + 512 + 256 + 128 + 64 + 32 + 8 + 2 = 2026. Hexadecimal (base 16) uses the digits 0–9 and A–F, so 2026 is 7EA: 7 × 256 + 14 × 16 + 10.
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 255 | 1111 1111 | 377 | FF |
| 2026 | 111 1110 1010 | 3752 | 7EA |
Why hex is popular
One hex digit is exactly four bits, so a byte is always two hex digits. That is why colors (#FF8800), memory addresses and byte values are written in hex.
Two’s complement
Computers store negative integers in two’s complement: invert all bits and add 1. In 8 bits, −1 is 1111 1111 and −128 is 1000 0000. The table shows the bit pattern for 8, 16, 32 and 64-bit integers when the value fits.
The converter works with whole numbers of any length; the prefixes 0x, 0b and 0o are accepted.
Frequently asked questions
How do I convert decimal to binary?
Divide by 2 repeatedly and write the remainders from last to first. 13 → 6 r1 → 3 r0 → 1 r1 → 0 r1, so 13 = 1101.
What is FF in decimal?
255 – 15 × 16 + 15.
How many bits does a hex digit hold?
Exactly four.