| Dec | Hex | Bin |
|---|
Convert decimal numbers to hexadecimal (baseโ16) and back โ with step-by-step division, byte grouping, all-bases view, and RGB color preview.
| Dec | Hex | Bin |
|---|
One hex digit represents exactly 4 binary bits (a nibble). Two hex digits represent a full byte (8 bits). This makes hex a compact, human-readable way to express binary data used in memory addresses, colour codes, and machine code.
After 9, hex uses letters A=10, B=11, C=12, D=13, E=14, F=15. So FF = 15ร16 + 15 = 255. This is why 0xFF is a common pattern in CSS, networking, and embedded programming.
HTML/CSS colours are written as #RRGGBB where each pair is a hex byte 00โFF. #FF0000 = Red (255,0,0), #00FF00 = Green, #0000FF = Blue. This tool previews 6-digit values as colours automatically.
In C, C++, Java, JavaScript, and Python, hex literals are written with a 0x prefix: 0xFF, 0x1A3B. This tells the compiler the literal is baseโ16, not decimal. The toggle adds this prefix automatically.