JustConvertAll-in-One Convert
Dev

Number Systems Explained: Binary, Hex, and Decimal

Computers think in binary, humans in decimal, and programmers meet in hexadecimal. Learn how positional number systems work, how to convert between bases, and why hex is everywhere from colors to memory addresses.

June 15, 2026·7 min read

Every number system you use is positional: the value of a digit depends on its position. In our everyday decimal system, the number 345 means 3 hundreds, 4 tens, and 5 ones — each position is a power of 10. Change the base and you change the multiplier for each position. Understanding this single idea unlocks binary, hexadecimal, and every other base computers rely on.

Decimal (Base 10)

Decimal uses ten digits, 0 through 9, and each position is a power of ten. The number 345 is 3×10² + 4×10¹ + 5×10⁰. It is the system humans default to, almost certainly because we have ten fingers, but there is nothing mathematically special about base 10.

Binary (Base 2)

Binary uses only two digits, 0 and 1, and each position is a power of two. Computers use binary because digital circuits naturally represent two states: on or off, high voltage or low. A single binary digit is a bit; eight bits make a byte, which can represent 256 distinct values (0–255).

Binary 1011 to decimal:
1×2³ + 0×2² + 1×2¹ + 1×2⁰
= 8 + 0 + 2 + 1
= 11

Hexadecimal (Base 16)

Hexadecimal uses sixteen digits: 0–9 followed by A–F, where A represents 10 and F represents 15. Each position is a power of sixteen. Hex exists because it is a compact, human-friendly shorthand for binary: exactly four bits map to one hex digit, so one byte is always two hex digits. The byte 11111111 is FF; 00000000 is 00. This tidy four-bits-per-digit relationship is why programmers read hex instead of long binary strings.

Binary:  1111 1010
Group:   F    A
Hex:     0xFA  = 250 decimal

Converting Between Bases

To convert from any base to decimal, multiply each digit by its positional power and sum the results. To convert from decimal to another base, repeatedly divide by the base and collect the remainders from bottom to top. Converting between binary and hex is the easiest of all: group binary digits into fours (from the right) and translate each group to a single hex digit, or expand each hex digit into its four-bit pattern.

Where You Meet Hex Every Day

  • Colors: CSS colors like #7C6AFF are three bytes — red, green, blue — each written as two hex digits.
  • Memory addresses: debuggers and stack traces print addresses such as 0x7ffee3b0 in hex for compactness.
  • Character codes: Unicode code points are written as U+1F600; byte values in hex dumps appear as 48 65 6C 6C 6F.
  • Hashes and IDs: SHA-256 digests, Git commit hashes, and MAC addresses are all rendered as hexadecimal.
The prefix tells you the base: 0b for binary (0b1011), 0x for hexadecimal (0xFA), and no prefix for decimal. When a value looks impossible — a 'number' containing letters, or 10 meaning two — check which base you are reading.

Try the tools