Learn how binary, octal, decimal, and hexadecimal number systems relate, and why hexadecimal is so useful for programmers.
The number you write as “202” in everyday decimal is exactly the same value as 11001010 in binary, 312 in octal, or CA in hexadecimal, they’re just four different ways of writing the same quantity, each useful in different contexts.
Each hexadecimal digit represents exactly 4 binary bits (since 16 = 24), so a long binary string can be written far more compactly in hex without losing any structure, converting between the two is just a matter of grouping bits four at a time. This is why hex shows up constantly in programming contexts like memory addresses and color codes.
The number 202 (decimal) written in each system:
| System | Value |
|---|---|
| Decimal (base 10) | 202 |
| Binary (base 2) | 11001010 |
| Octal (base 8) | 312 |
| Hexadecimal (base 16) | CA |
The Number Base Converter converts between binary, octal, decimal, and hexadecimal instantly.
Number Base Converter
Because digital circuits naturally represent two states (on/off, high/low voltage), binary’s two digits (0 and 1) map directly onto that hardware reality.
Multiply each hex digit by 16 raised to its position power, then sum the results. Using a converter avoids doing this by hand for anything beyond a couple of digits.
Hexadecimal represents the exact same information as binary but far more compactly, since each hex digit stands in for 4 binary digits, making long values much easier to read and write.
Rarely. It was more common in early computing systems built around 6-bit or 12-bit word sizes; hexadecimal has largely replaced it in modern programming.
0 through 9, followed by A through F, representing the values 10 through 15.
Find the right tool, or keep reading Brekzy's other guides.