About decimal to hex converter
To convert decimal to hex, divide by 16 repeatedly and read the remainders from the last to the first, writing 10 to 15 as A to F. For example 255 gives FF.
Worked example
Convert 300. 300 ÷ 16 = 18 remainder 12 (C), then 18 ÷ 16 = 1 remainder 2, then 1 ÷ 16 = 0 remainder 1. Reading upward gives 12C. Check: 1 × 256 + 2 × 16 + 12 = 300. Values from 0 to 255 fit into two hex digits, and 256 is the first value that needs three (100).
How place values work
Each digit position is worth a power of the base. In decimal the places are 1, 10, 100, 1000 and so on. In binary they are 1, 2, 4, 8, 16, and in hexadecimal 1, 16, 256, 4096.
Why hexadecimal matters
- Computers store everything as binary; hexadecimal and octal are compact ways to write it.
- One hex digit equals exactly four binary digits, which is why programmers use it for colours, memory addresses and byte values.
- Octal groups three bits per digit and appears in Unix file permissions such as 755.
