Quick answer: 255 in decimal is 1111 1111 in binary (8 ones), 377 in octal and FF in hexadecimal.
How it's calculated
In base b, each digit is worth b times the digit to its right: 2F in hexadecimal is 2 × 16 + 15 = 47. Digits above 9 are letters: A = 10, B = 11 … Z = 35, so base 36 uses 0–9 and A–Z.
To convert, the number is read into its value, then divided by the new base again and again; the remainders, read backwards, are the new digits. Calculations use exact big integers, so long binary or hex values do not lose digits.
Prefixes 0x (hex), 0b (binary) and 0o (octal) are accepted and ignored. Fractions are not converted.
Worked examples
- 255 (base 10) → base 16: FF
- 1010 (base 2) → base 10: 1×8 + 0×4 + 1×2 + 0 = 10
- 2F (base 16) → base 10: 2 × 16 + 15 = 47
Decimal, binary, octal and hex
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 32 | 100000 | 40 | 20 |
| 100 | 1100100 | 144 | 64 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1000 | 1111101000 | 1750 | 3E8 |
| 1024 | 10000000000 | 2000 | 400 |
Frequently asked questions
Why do programmers use hexadecimal?
One hex digit is exactly four binary digits, so a byte (8 bits) is always two hex digits, such as FF for 255.
What is the highest base supported?
Base 36, which uses all ten digits and 26 letters.
Are negative numbers supported?
Yes, with a leading minus sign. The result is shown with a minus sign, not as two's complement.
How do I convert binary to decimal by hand?
Under each digit, from the right, write 1, 2, 4, 8 and so on, then add up the ones sitting under a 1. For 1011 that's 8 + 2 + 1 = 11.
What is 255 in hexadecimal?
FF, the biggest number a single byte can hold.
Why is octal still used?
Each octal digit stands for exactly three bits, which suited early computers. These days you'll mostly meet it in Unix file permissions like 755.