What is a number base?
A number base (or radix) is how many different digits a number system uses. We count in base 10 (decimal), with the digits 0 to 9. Computers work in base 2 (binary), with only 0 and 1. Programmers also use base 16 (hexadecimal), with 0–9 and A–F, and base 8 (octal), with 0–7, because they are compact ways to write binary. This converter switches any whole number between these systems and any base up to 36.
How to use the converter
- Type the number. Prefixes such as
0xfor hex and0bfor binary are accepted. - Select the base it is written in.
- Read the result in binary, octal, decimal, hex and an extra base of your choice. The working shows how the conversion is done.
How conversion works
Any base to decimal
Each digit is worth its value times the base raised to its position, counting from 0 on the right:
FF (hex) = 15 × 16¹ + 15 × 16⁰ = 240 + 15 = 255
1101 (binary) = 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 8 + 4 + 0 + 1 = 13
Decimal to any base
Divide repeatedly by the base and write down the remainders. Reading the remainders from the last to the first gives the answer. For 13 in binary: 13 ÷ 2 = 6 r1, 6 ÷ 2 = 3 r0, 3 ÷ 2 = 1 r1, 1 ÷ 2 = 0 r1, giving 1101.
Quick reference
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 255 | 11111111 | 377 | FF |
| 1024 | 10000000000 | 2000 | 400 |
Each hex digit equals exactly 4 binary digits, and each octal digit equals 3, which is why programmers use them as shorthand for binary.
Frequently asked questions
How big a number can I convert?
There is no practical limit. The tool uses JavaScript BigInt, so numbers with hundreds of digits convert exactly.
Does it convert fractions?
No, only whole numbers (including negative ones).
How do I convert text into binary?
Use the Text to Binary Converter, which converts letters rather than numbers.