Start counting positions at zero
In binary, 1010 = 1 × 2³ + 0 × 2² + 1 × 2¹ + 0 × 2⁰ = 10 in decimal.
One number. Four ways to write it. See how each conversion works.
Whole numbers only. Use a leading minus for negatives. Matching 0b, 0o and 0x prefixes are optional.
Exact integer conversion · up to 4096 bits
The input and explanation bases are the same. Choose a different base to follow a conversion.
Read positions from right to left, starting at power 0. A–F have values 10–15.
4 × 10¹ + 2 × 10⁰ = 42
The place-value expansion is hidden for inputs longer than 16 digits. All four results are still exact.
Divide the magnitude repeatedly. Read the remainders from bottom to top.
Showing the first 16 divisions. More steps are needed; the full result above is exact.
Convert the magnitude, then put the minus sign back. These are signed numbers, not two’s-complement bit patterns.
Open an example in the converter, then follow the conversion.
Ten questions using zero and positive whole numbers. Practise decimal ↔ binary, octal and hex. One scored answer per question; hints are always available.
Your chosen settings apply to the next set.
Your numbers, answers and scores stay in this tab. They are not uploaded or saved.
| Base | Value | Allowed digits |
|---|---|---|
| Binary | 2 | 0–1 |
| Octal | 8 | 0–7 |
| Decimal | 10 | 0–9 |
| Hexadecimal | 16 | 0–9, A–F |
In binary, 1010 = 1 × 2³ + 0 × 2² + 1 × 2¹ + 0 × 2⁰ = 10 in decimal.
In hexadecimal, A = 10 through F = 15. FF is 15 × 16 + 15 = 255 in decimal.
−42 in decimal becomes −101010 in binary. This tool does not assume a bit width or encode two’s complement.
Each position represents a power of its base. Binary uses powers of 2; octal uses 8; decimal uses 10; hexadecimal uses 16. Leading zeros do not change the value. Hex letters are case-insensitive.
About exact integer representation ↗Conversions use integer arithmetic without rounding. Magnitudes up to 4096 bits are supported. Results are exact even beyond the safe range of ordinary JavaScript numbers.
Yes. With hexadecimal selected, 0xFF is accepted; binary accepts 0b and octal accepts 0o. A prefix does not switch the selected base. Uppercase and lowercase letters both work.
A minus sign is preserved in every base. This tool converts signed mathematical integers, not fixed-width machine representations. For example, −1 remains −1 rather than becoming a string of 1 bits.
This version accepts whole numbers only. Decimal fractions, digit separators and scientific notation are not accepted. In hex, E is a digit, so 1E3 means 483 in decimal.
Each set contains ten distinct numerical values. New sets are generated randomly, so numbers can repeat between sets. No answer history or scores are saved.