When to use it
Use this tool to convert numbers between decimal, binary, hexadecimal, octal and any base from 2 to 36. It is useful for programming, computer science homework, networking, electronics, reading color codes, and understanding how computers store data.
How to use it
- Type a number in any box: Decimal, Binary, Hexadecimal or Octal. The others update instantly.
- To use another base, set Other base to a number from 2 to 36 and type in the box next to it.
- Read Binary, grouped in bytes, which shows the binary value in groups of 8 bits and how many bytes it needs.
- Click Copy next to any value.
Worked example
The default value is 255. In binary that is 11111111, in hexadecimal FF and in octal 377. The byte view says it uses 8 bits and fits in 1 byte, which is why 255 is the largest value of a single byte.
For a web color, the hex code #1D4ED8 has a red part of 1D. Type 1D in Hexadecimal and the decimal box shows 29. That is the same red value you would see written as rgb(29, 78, 216).
In base 36, 255 is written 73, since 7 × 36 + 3 = 255.
How to convert by hand
To turn decimal into binary, keep dividing by 2 and write down the remainders, then read them from bottom to top. For 13: 13 ÷ 2 = 6 r1, 6 ÷ 2 = 3 r0, 3 ÷ 2 = 1 r1, 1 ÷ 2 = 0 r1. Reading upwards gives 1101.
Where you will meet each base
- Binary: how computers store everything, from numbers to images.
- Hexadecimal: colors in CSS, memory addresses, MAC addresses and error codes.
- Octal: Linux and Unix file permissions, such as 644 and 755.
Tips
- Group binary in fours. Each group of four bits is one hexadecimal digit, so 1111 1111 is F F.
- Use hexadecimal for long binary values. It is shorter and easier to read.
- Check permissions on Linux. File permissions like 755 are octal numbers: 7 is 111 in binary, meaning read, write and execute.
Common mistakes
- Mixing up O and 0. Hexadecimal only uses the digits 0 to 9 and the letters A to F.
- Expecting 10 to mean ten. In binary, 10 is two. In hexadecimal, 10 is sixteen.
- Dropping leading zeros in fixed-width values. 00001111 and 1111 are the same number, but some systems expect all 8 bits.