Logic problem 6 of 30

Counting in hex

  • Logic
  • Easy
  1. What is the hexadecimal number 0x2A in decimal?
  2. What is the largest number you can write with two hex digits, and why is that number so common in computing?
Show hint

Hex digits go 0 to 9, then A (10) to F (15). The place values are 1, 16, 256 and so on.

Show solution
  1. 42. 2 × 16 + 10 (A) = 42.
  2. 0xFF = 255. One hex digit is exactly 4 bits, so two hex digits are 8 bits, one byte, which holds 256 values from 0 to 255. That is why colours like #1d4ed8 use two hex digits per channel.

Want a problem like this every day? See today's problem and keep a streak going.